led.toggle()

Category:Circuit Playground

Alternates from turning the red LED on and off

Changes based on the current state of the LED. If the LED is on when you use led.toggle(), then it will turn off after being called.

Examples

onBoardEvent(buttonL, "down", function(event) {
  led.toggle();
});

Syntax

led.toggle()

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