Adding sound to your robotic project can be the difference between a good robot and an awesome robot. Just think about how cute R2-D2, from the movie Star Wars, would have been if he did not make any sound. We can use sound for more than just robots. For example, we may want to add a loud alarm if a motion sensor detects motion or maybe we just want to play a melody when the temperature is just right outside.
In this chapter, you will learn:
- How to connect a piezo buzzer to the Arduino
- How to connect a speaker to the Arduino
- How to use the tone() function to generate a sound
- How to play music with the Arduino