Site Navigation

Your Account

Choose Language

Tools

No tools required.

Parts

Video Overview

Plug your Buzzer in so that the positive pin is on the right hand side.
  • Plug your Buzzer in so that the positive pin is on the right hand side.

  • There are markings on the buzzer which indicate the positive and negative pins.

Add Comment

Connect the Digital Pin 9 to the Buzzer's positive pin.
  • Connect the Digital Pin 9 to the Buzzer's positive pin.

Add Comment

Connect the Ground to the Buzzer's negative pin.
  • Connect the Ground to the Buzzer's negative pin.

Add Comment

  • Copy this code to the Arduino IDE

  • Upload the code and your buzzer should start to beep on and off

Add Comment

  • A quick search for "Arduino Buzzer Jingle Bells" turned up this code by elubow

  • Give it a try!

  • Note - look at the code and see you need to change buzzer jumper wire to Pin 5

Add Comment

Plug the other pin into GND Plug the other pin into GND
  • Plug the other pin into GND

Add Comment

Conclusion

Today you can get musical! After plugging in your buzzer you should be able to get sound from it. By changing the values you can make it buzz for longer or shorter. You can see how elubow has written code to make music.

14 other people completed this guide.

Madeleine Schappi

Member since: 09/27/2017

4,557 Reputation

55 Guides authored

Team

Advent Edit Member of Advent Edit

Community

3 Members

55 Guides authored

One Comment

In Step 5, is someone able to explain what the “i += tone * 2” afterthought in the for loop within the playTone function is doing? I understand that inside the for loop the tone variable is creating the square wave at the required frequency, but why is the loop iterating on the tone * 2? I’m guessing its controlling the duration of note at a certain frequency? but i don’t understand how. thanks.

Duncan - Reply

Add Comment

View Statistics:

Past 24 Hours: 0

Past 7 Days: 3

Past 30 Days: 8

All Time: 210