toggleLED() — Maple v0.0.12 Documentation

### Navigation

- next
- previous |
- LeafLabs |
- Index »
- Complete Language Index »

# toggleLED()

Toggle the built-in LED: switch it from off to on, or on to off.

## Library Documentation

void toggleLED()

  Toggle the LED.

  If the LED is on, turn it off. If it is off, turn it on.

  The LED must its mode set to OUTPUT. This can be accomplished portably over all LeafLabs boards by calling pinMode(BOARD_LED_PIN, OUTPUT) before calling this function.

  See: | pinMode()

## Example

This example sets up the board’s LED pin for output, then toggles the LED every 100 milliseconds:

    void setup() {
        pinMode(BOARD_LED_PIN, OUTPUT);
    }

    void loop() {
        toggleLED();
        delay(100);
    }

## See Also

- BOARD_LED_PIN
- togglePin()

### Navigation

- next
- previous |
- LeafLabs |
- Index »
- Complete Language Index »