I need some code to pause the Arduino code until a button is pressed. I have a long program and at point I need a condition that if a Button on pin A2 is pressed then go forward, otherwise wait.
I tried using if
with a condition but it failed for my purpose. I think this is because when if(...)
detects that the button is not pressed, it moves to next lines (as usual). But I have a long program and I want to wait forever until the button is pressed.