O'Reilly logo

Mastering Arduino by Jon Hoffman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Fun with Sound

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required