I am using arduino button library, Arduino Playground - Button Library . In my setup I would like to wait for a button press then continue to loop at the end of my setup function I have,
while(button.isPressed() == false);
initialized with
Button button = Button(9,PULLUP);
But sometimes I have to press it multiple times for it recognize a button press. How do you guys wait for an button event?
Previously I was using
while(digitalRead(BUTTON_PIN)){
delay(100);
}
but it had the same problem, since after multiple presses it works I am assuming problem is code related, button is on a protoshield.