The best way to learn about the Arduino is to play with the basic examples in the Arduino IDE. In this instructable I'm going to show you how to generate a melody from an Arduino. The Arduino might not have enough ram to stream music but it has sufficient ram to generate some common melody.
Note- An Arduino is not capable handling a speaker on its own, so an external amplifier is required.
So lets get started....
Step 1: Tools and Components
All that you need for this instructable is -
- Arduino UNO
- A Speaker with an amplifier
- Alligator clips
- Jumper wires
Step 2: Circuit
Well, there is not much of a circuit all you need is to clip the alligator clips as shown in the picture and connect one of the clips to Arduino ground and the other to Digital pin 8, with the help of some jumper wires. Make sure you do not touch the 3.5mm wire when the speaker is ON.
Step 3: Code
The code for a test melody can be found in the Arduino IDE under examples => digital => tone melody. The tone will only stream once you can run it again by hitting the reset button.
Or just copy the code below and paste it in the IDE.