Making Music

In this project, you'll learn how to generate sound with the Arduino.

Parts needed: Arduino      Buzzer      Breadboard     
1 Making the connections
  • Connect the + terminal on the buzzer to pin 8.
  • Connect the other terminal on the buzzer to GND.
Tone connections
2 Create a new program by selecting File from the menu,
then select New.
3 Type in this program. Tone Melody
4 Upload and run the program. You should hear a note for one second.

The tone command generates a music note in the given frequency, in this case 440 Hz.

The noTone command stops the sound.
5 Change the number 440 in the tone command to 523.
Upload and run the program again.
What do you notice? Experiment with other numbers.
6 This next program will play several notes of a song. Create a new program by selecting File from the menu, then select New. Type in this program. Tone Melody
7 Upload and run the program. You should hear a song.