Generating sound: Buzzer
Play a melody with a passive buzzer
What are we going to do?
In this activity you'll play a melody with the help of a passive buzzer. Remember the difference between putting code inside setup function or putting it inside loop function.
You can use the code from Arduino IDE -> File -> Examples -> Digital -> toneMelody but you'll need to change some parts.
Let's get started
Follow these instructions carefully. You can click on some of the images to zoom in.
Always connect the components BEFORE powering the UNO board or YOU MAY DAMAGE YOUR BOARD OR COMPONENTS.
Now, what else?
Now is your turn:
- Change the code to use a variable instead of the number 8. What do you think would be a good name for this variable?
- Search the Internet and try changing the melody to a famous song or soundtrack