We will be making a very basic musical instument using only the starter kit of Arduino uno. The end product will be an instrument that has 4 keys that each produce a different sound. For flare we will add 4 LED's that will corrispond to a specific key and will light up when that key is pressed.
Step 1: Materials
We will be using 8 resistors, 4 LED's, 1 Buzzer, 4 Buttons, 13 short cables (4 yellow, 4 orange, 4 red and 1 green), 3 long cables and of course the Arduino with breadbord.
Step 2: Where Do the Parts Go?
In my code I have this set up for the pins:
button 1 = 13
button 2 = 12
button 3 = 11
button 4 = 10
LED 1 = 7
LED 2 = 6
LED 3 = 5
LED 4 = 4
I use yellow cables to inducate input for the buttons, so these will go in slot 10 to 13. I use orange cables for the LED's, so these go in slots 4 to 7. The 5V slot will be used to power the buttons via the +strip (the 4 red cables connect the buttons to the +strip). The power GND will be used for the resistors of the LED's. The digital GND will be connected to the resistors of the buttons. A green cable will go from slot 2 to the buzzer, the buzzer is connected to the digital GND.
A video showing this setup can be found here:
Step 3: The Code
The code to make this work is shown in the pictures.
Note that I make a comment at the start documenting which pins correlate to which buttons/LEDs.
It's important that you do that to not lose track of your pins.
If you want to change the sound your buzzer makes you can change the "tone(buzzer, xxxx)".
Those x's represent the number used to indicate sound frequency. Change those numbers to change the sound the buzzer makes.
Step 4: The Result
Now that everything is done you can take it upon yourself to improve and elaborate on this Arduino project, or just enjoy the tiny musical instrument you've made!