Introduction: Arduino - 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.

Step 1: Hardware Required

Picture of Hardware Required

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

Step 2: Connections

Picture of Connections

  • 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

Step 3: Code

Picture of Code

  • Get the Code :

  • First, include the pitches.h library.

Step 4: If It Helps, Please Subscribe

Picture of If It Helps, Please Subscribe

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


About This Instructable




Bio: For more project and tutorial visit my YouTube channel Mert Arduino and Raspberry Pi
More by MertArduino:XY Plotter Drawing Robot | Arduino | PolargraphArduino - Balance - Balancing Robot | How to Make?Arduino - MPU6050 GY521 - 6 Axis Accelerometer + Gyro (3D Simulation With Processing)
Add instructable to: