Interrupts allow the microcontroller to respond to an external signal, such as the change in state of a device, while performing another task. An interrupt pauses the sketch and implements the interrupt service routine (ISR), then the sketch continues from the point that it was interrupted.
There are at least three approaches for scheduling an event to occur after a certain period of time has elapsed. The simplest is the delay() function, which pauses the sketch for the required number of milliseconds. A second approach is to use the millis() function, which returns the number of milliseconds that ...