Arduino - Button Buzzer Melody

by MertArduino in Circuits > Arduino

17442 Views, 16 Favorites, 0 Comments

Arduino - Button Buzzer Melody

Arduino Basic Tutorial 09 : Button Buzzer Melody

Play a Melody using the tone() function.

With this tutorial, we will be able to hear the melody when the button is pressed.

Hardware Required

vlcsnap-2016-12-01-21h26m49s188.png

  • Arduino Board
  • Buzzer
  • Button
  • 10k resistor
  • Wires
  • Breadboard

Connections

vlcsnap-2016-12-01-21h27m14s742.png
vlcsnap-2016-12-01-21h28m15s463.png
vlcsnap-2016-12-01-21h28m36s989.png
vlcsnap-2016-12-01-21h29m03s386.png
vlcsnap-2016-12-01-21h29m23s660.png
vlcsnap-2016-12-01-21h29m45s841.png
vlcsnap-2016-12-01-21h30m12s423.png
vlcsnap-2016-12-01-21h30m41s149.png
vlcsnap-2016-12-01-21h30m54s920.png
vlcsnap-2016-12-01-21h31m17s328.png

  • The button attach to the board
  • The 10k resistor connect to the button's leg
  • Resistor empty leg connect to ground
  • The button's other leg connect to +5V
  • The button's top leg connect to digital 12
  • The buzzer attach to the board
  • The buzzer's short leg (-) connect to ground
  • The buzzer's long leg (+) connect to digital 8

Code

vlcsnap-2016-12-01-21h31m48s541.png

  • Get the Code :

http://mertarduinotutorial.blogspot.com.tr/2016/11/buzzer-button-melody.html

  • First, include the pitches.h library.

If It Helps, Please Subscribe

vlcsnap-2016-12-01-21h32m17s300.png

First of all, I would like to thank you for reading this guide ! I hope it helps you.

If you want to support me, you can subscribe my channel and watch my videos.

Visit My Youtube Channel - Mert Arduino Tutorial & Projects