6Making Sounds and Music
Parts You'll Need for This Chapter
- Arduino Uno or Adafruit METRO 328
- USB cable (Type A to B for Uno, Type A to Micro-B for METRO)
- Half-size or full-size breadboard
- Assorted jumper wires
- Pushbuttons (×5)
- 220Ω resistor
- 10kΩ resistors (×5)
- 10kΩ potentiometer
- 8Ω loudspeaker
- CODE AND DIGITAL CONTENT FOR THIS CHAPTER
- Code downloads, videos, and other digital content for this chapter can be found at:
exploringarduino.com/content2/ch6- Code for this chapter can also be obtained from the Downloads tab on this book's Wiley web page:
wiley.com/go/exploringarduino2e
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 bad 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 your 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 ...