The button example program does not work properly. While you hold down the button, the LED oscillates off and on rapidly. I suppose it is possible that that is proper operation, it would make more sense to have the switch to the opposite state when the button is pressed.
This is true in release 0.0.11, using a brand spanking new Maple Mini.
This should be fixed with the simple addition of a while(isButtonPressed()); statement inside the if block. However, this does not seem to help, even with a 1ms delay added for debounce.
Ok, I added a 10ms delay, and it seems to work properly now, except that the toggle is happening when I release the button, instead on press like it should.
void setup() {
// Initialize the built-in LED pin as an output:
pinMode(BOARD_LED_PIN, OUTPUT);
// Initialize the built-in button (labeled BUT) as an input:
pinMode(BOARD_BUTTON_PIN, INPUT);
}
void loop() {
// Check if the button is pressed.
if (isButtonPressed())
{
// If so, turn the LED from on to off, or from off to on:
toggleLED();
while(isButtonPressed());
delay(10);
}
}