button(L/R)

Category:Circuit

buttons buttonL and buttonR are objects representing the two pushbuttons on the Circuit Playground. Internally buttonL is connected to pin 4 and buttonR is connected to pin 19.

Properties and Methods

  • buttonL.isPressed - Boolean property, true is the button is being pushed down, otherwise false
  • buttonL.holdtime - Number of milliseconds for button to be held down before "hold" event is fired

Events

  • "press" - Fired when button is pressed down and then released
  • "down" - Fired when button is pressed down
  • "up" - Fired when button is released
  • "hold" - Fired when button has been held down for duration set by button.holdtime

Found a bug in the documentation? Let us know at documentation@code.org