Button

Adding a push button to your circuit.

A button is a digital device, it reads either pressed or not pressed. The Arduino is set up to consider a reading of 5V as “true”, so with the circuit below, digital reading () :: #468cfc reporter gives true when the button is not pressed.

I will use button pressed? :: variables reporter for the variable that holds the reading from the button.


when green flag clicked
forever
  set [button pressed? v] to < not < digital reading (10) :: #468cfc> >
  if (button pressed?) then
    say [Pressed] for (0.5) seconds
  else
    say [Not Pressed] for (0.5) seconds

Last modified August 18, 2023: 2022-2023 End State (7352e87)