Wait for the board’s built-in button to be pressed, possibly with timeout. The button is labeled “BUT” on the board’s silkscreen. Its pin number is the constant BOARD_BUTTON_PIN.
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: |
|
---|---|
Return: | true, if the button was pressed; false, if the timeout was reached. |
See: |
void setup() {
pinMode(BOARD_BUTTON_PIN, INPUT);
}
void loop() {
waitForButtonPress();
SerialUSB.println("You pressed the button!");
}