Wait x time for Button Press Else Continue

Hi all

I have a need for a system that will at boot wait for a Button press .. and if its pressed then continue to a specific loop ( i have this working) , however what i want it wait for the Button press for say 30 seconds , if its not pressed then go to another loop :

what i have so far ..

#define TRIGGER_PIN 0

void setup() {
Serial.begin(115200);
Serial.println("\n Waiting For Button Press");

pinMode(TRIGGER_PIN, INPUT);
}

what i have so far ..

you actually have more than the code you've posted :wink:

anyway, have a look at the "blink without delay" example, and use it :slight_smile:

Hint, millis() :wink:

And a tip, drop the define and do

const byte TriggerPin = 0;

and note pin 0 is for serial on a lot of devices.