Hardware Reference
In-Depth Information
That's where interrupts come in. Select pins on your Arduino (or all pins
on the Due) can function as external hardware interrupts. Hardware within
the ATMega knows the state of these pins and can report their values to your
code asynchronously. Hence, you can execute your main program, and have it
“interrupted” to run a special function whenever an external interrupt event
is detected. This interrupt can happen anywhere in the program's execution.
Figure 12-1 shows what this process could look like in practice.
Figure 12-1: How an external interrupt affects program flow
KnowingtheTradeoffsBetweenPollingandInterrupting
Hardware interrupts are an alternative to repeatedly polling external inputs
in loop() . They are not better or worse; instead, there are tradeoffs between
using the two. When designing a system, you must consider all your options
and choose the appropriate one for your application. This section describes the
Search WWH ::




Custom Search