This was a project made in a camp. I will not be going over any of the code, but rather give you it to play around with.
Step 1: Circuits / Setup
The project is simple, an Arduino that has both hands-on and automatic music at the same time. You will need:
Breadboard x 2
LEDs x 5
Speaker x 1
Buttons x 6
10k Resistors x 6
4.7k Resistors x 5
Jumper Wires x 14
different Size Wires x 12
This design can light up the lights on its own along with playing a self made/premade tune with coding.
First, start with attaching the two breadboards so that you make a longer/bigger area. Add Jumper cable going from 5V to the positive strip on the right breadboard.
Next send 6 short wires down to the columns in which you will set up a simple button across the middle of the breadboard. (Do this with all 6 of the wires and buttons.)
Once that it done, take different lengths of wires and attach them to the buttons along the other side of the breadboard and bring them over to the other breadboard in different columns so that they are no on the same row for further use.
Fourthly, pick up the 10k resistors and and put them in each row that the wires were inserted. Pu the end of the resistors into that breadboard's negative power row. Attach a jumper wire from the negative strip you just used into one of the GND sockets on the Arduino.
Next, attach 6 jumper wires into the Arduino in slots 13-8 and the other ends into the different rows with the wires and resistors we put in earlier. (You now have a working keyboard setup.)
Now for the lights (optional.) Wire 5 jumper cables into the Arduino on Digital 7-3 and the other end goes to the left breadboard. Jump the middle of the rows with the 5 4.7k resistors. There you will take the powered row and have the 5 LEDs going from those rows into the negative strip to ground.
Finally, take one more jumper cable and attach it in slot 2 and one unused row. Have the current flow from one row, through the speaker, to another. Attach a wire to that row straight to the negative strip.
Congrats, you're done!
Step 2: Programing
I will include the program that I used to make this play on its own and also play when you press the buttons (after)
The tune that I made is the Mario Theme and is not mine. I did however make it from scratch so it is not exactly the same. You can make what ever you want in the load-up of the Arduino in the code. Happy playing!
7 years ago on Introduction
I love arduino! Thanks for sharing your project!