How to blink (or flash) a LED without delay() and detect button pushes
One of the limitations of the delay() function is that nothing else can really be done. This presents a problem when you want to flash a LED while waiting for a pushbutton to be pressed.
Flashing the LED with millis() and using a flag variable to find if the LED should be flashing solves this problem.
Consider this another example to my virtual millis() cookbook.