5

Taking Control with Hardware Interrupts

So far, the code for your projects in this book has been sequential. Any deviations from a linear pattern, such as detecting button presses, required you to monitor digital inputs. However, preplanning button presses in your code isn’t always efficient or realistic. Hardware interrupts allow your programs to respond to events more efficiently and dynamically.

Hardware interrupts enable the AVR microcontroller to react to a change of state at a digital input pin at any time. In a way, they allow your AVR to multitask: when a button is pressed or when a signal is received at a digital input, the AVR ...

Get AVR Workshop now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.