Arduino Interrupts
Arduino, like most microcontrollers, can really only do one thing at a time. Many projects require doing one thing while paying attention to other inputs e.g. playing a tune while checking the pushbuttons to see if a different tune has been requested.
If the microcontroller is performing one main task, interrupts provide a means to interrupt this task to perform less frequent, short, time-sensitive tasks.
Interrupts come in a variety of flavors. Perhaps the easiest to use are the so-called external interrupts, INT0 and INT1, available on digital pins 2 and 3 respectively.
Like digitalRead(), the interrupts provide a way to sense the voltage level at the respective pin. Unlike digitalRead(), changes on these pins automatically cause the program to be aware of it, without the program explicitly calling digitalRead().
How does it do this? Come back next week to find out.
Leave a Reply