gmmazar

Alright here's my problem. I have an arduino uno that I just bought and I need to have a sequence of five LED's turn on with a press of a button (first press turns on first LED, second turns on the second LED, etc). However, I also need to put in a time control where after I press the button to turn on the first LED, a timer begins to count down from one minute twenty seconds. After the time gets to one minute, I need the LED's to remain in their current state whether it be on or off, and then after an additional twenty seconds they turn off. So far, I have the LED's working, but I've spent hours trying to find some way to start a countdown with no progress whatsoever :0 . Please help.

You have a 1:20 time interval. The timer starts when you press the button. You track the number of button presses for the first 20 seconds. You display that number for 20 seconds, then you turn off the LED's for the remaining 40 seconds?

State 0: All LED's are off. No buttons are pressed. Timer is not running. On button press, Start timer, increment number of lights, got to State 1

State 1: Some number of LED's are lit and timer is running. On button press, increment number of lights. On timer reaches 20 seconds (1:20->1:00): Re-start timer. Go to State 2

State 2: Some number of LED's are lit and timer is running. On timer reaches 20 seconds (1:00->0:40): Turn off all LED's. Re-start timer. Go to State 3

State 3: Lights are off. Timer is running. On timer reaches 40 seconds (0:40->0:00): Go to State 0

Normally one 'starts a timer' by taking note of the current value of millis() (number of milliseconds since the Arduino started) and then checks for millis() >= (start_time + millisecondsToWait.