Using Pushbuttons and millis() to Delay Events – Without delay() #Arduino
This is great. James “Bald Engineer” gives a thorough walkthrough, line-by-line, of an Arduino sketch to use a pushbutton and millis() to delay events, without using delay()! It’s simple and simply explained on his blog.
In this example, we will use millis() to wait a few seconds after a pushbutton press to turn on an LED. Then a few seconds later, we will turn it off. All without using delay().