Hardware and Timer Interrupts
Parts You'll Need for This Chapter
Arduino (Uno recommended)
USB cables for programming Arduino
Common cathode RGB LED
220Ω resistors (×3)
10uF electrolytic capacitor
74HC14 hex inverting Schmitt trigger IC
CODE AND DIGITAL CONTENT FOR THIS CHAPTER
Code downloads, video, and other digital content for this chapter can be found at www.exploringarduino.com/content/ch12.
In addition, all code can be found at www.wiiey.com/remtitie.cgi?isbn=1118549368 on the Download Code tab. The code is in the chapter 12 download and individually named according to the names throughout the chapter.
Up to this point, every Arduino program you've written has been synchronous. This presents a few problems, namely that using deiay() can preclude your Arduino from doing other things. In the preceding chapter, you created a software timer using millis() to avoid the synchronous blocking nature of delay(). In this chapter, you take this idea a step further by adding both timer and hardware interrupts. Interrupts make it possible to execute code asynchronously by triggering certain events (time elapsed, input state change, and so on). Interrupts, as their name implies, allow you to stop whatever your Arduino is currently doing, complete a different task, and then return to what the Arduino was previously executing. In this chapter, you learn how to execute interrupts when timed ...