CHAPTER 5

Making Sounds

Parts You'll Need for This Chapter

Arduino Uno

USB cable

Pushbuttons (×5)

10kΩ resistors (×5)

150Ω resistor

Jumper wires

Breadboard

10KΩ potentiometer

8Ω loudspeaker

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

The wiley.com code downloads for this chapter are found at www.wiley.com/go/exploringarduino on the Download Code tab. The code is in the chapter 05 download and individually named according to the names throughout the chapter.

Humans have five senses. As you might have guessed, you won't be interfacing your sense of taste with too many electronics; licking your Arduino is a poor idea. Similarly, smell won't generally come into play. In fact, if you can smell your electronics, something is probably burning (and you should stop what you're doing). That just leaves the senses of touch, sight, and sound. You've already interfaced with potentiometers and buttons that take advantage of your sense of touch, and you've hooked up LEDs that interface with you sense of sight. Now, what about your auditory senses? This chapter focuses on using the Arduino to make sounds so that you can more easily gather feedback from your projects.

You can generate sound with an Arduino in a number of ways. The simplest method is to use the tone() function, which this chapter focuses on most heavily. However, you can also use various shields that add more complex, ...

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.