Simple button press NO contact
LED lights
delay(x)
So I set the millis 5000, push the button momentarily, LED lights and stays on 5s.
Then I push the button and hold it down, LED lights and stays lit whatever duration the button closed.
But when button released the LED does not stay lit for 5s???
I'm missing something here??? Sketch initialized delay on button push. I thought as long as button was closed each time the program cycled and found the contact closed it set the delay over and over, not just a one shot deal??? What is going on here? What have I missed?
The functions delay() and delayMicroseconds() block the Arduino until they complete.
Have a look at how millis() is used to manage timing without blocking in Several Things at a Time.