waitForButtonPress() — Maple v0.0.9 Documentation

### Navigation

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

# waitForButtonPress()

Wait for the board’s built-in button (labeled BUT on the silkscreen) to be pressed, possibly with timeout.

## Library Documentation

uint8 waitForButtonPress(uint32 timeout_millis)

  Wait until the button is pressed and released, timing out if no press occurs.

  The button pin must have its mode set to INPUT. This can be accomplished portably over all LeafLabs boards by calling pinMode(BOARD_BUTTON_PIN, INPUT).

  Parameters

  - `timeout_millis` -

    Number of milliseconds to wait until the button is pressed. If timeout_millis is 0, wait forever.

  Return
    true, if the button was pressed; false, if the timeout was reached.
  See
    pinMode()

## See Also

- isButtonPressed()

### Navigation

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