CHAPTER 12

Hardware and Timer Interrupts

Parts You'll Need for This Chapter

Arduino (Uno recommended)

USB cables for programming Arduino

Pushbutton

Piezo buzzer

Common cathode RGB LED

10kΩ resistor

100Ω resistor

150Ω resistor

220Ω resistors (×3)

10uF electrolytic capacitor

74HC14 hex inverting Schmitt trigger IC

Jumper wires

Breadboard

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 ...

Get Exploring Arduino: Tools and Techniques for Engineering Wizardry 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.