Introduction: Arduino Uno Tutorial #2 - the Buzzer Song
Hello everyone, as I saw that my first tutorial had been a good gamble, I decided that I'm gonna do a series of Arduino Uno tutorials for you!
Step 1: What You Need
For the buzzer song, you will gonna need :
-Arduino Uno Board ;
-A Buzzer (I don't have a breadboard, so I improvised with jumper wires)
-Usb cable;
-Arduino IDE in your computer;
Step 2: Conect the Board and the Buzzer
Now conect your board in the computer and conect the buzzer like the scheme on the pictures.
If you don´t have a resistor you can conect the buzzer without it, but be cautious with the polarity of the buzzer, so you don't burn it.
Step 3: Upload the Program and Finished!
The last step is too upload the program below to your Arduino IDE and to your board.
#define BUZZER 9
int notes[] = { 524, 588, 660, 699, 785, 881, 989 };
void setup()
{
pinMode(BUZZER, OUTPUT);
}
void loop()
{
for (int i = 0; i < 7; i++)
{
tone(BUZZER, notes[i], 1000); delay(1000);
}
delay(1000);
}
And you're done.
Enjoy!
Step 4: Don't Forget to Follow!
Follow for more Arduino madness!