loading

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!

<p>here's a helpful tip: use HTML such as &lt;pre&gt;&lt;/pre&gt; for posting code to your instructables. Here's an example of where I used it:</p><p><a href="https://www.instructables.com/id/Arduino-LED-Temperature-Indicator/">https://www.instructables.com/id/Arduino-LED-Temper...</a></p><p>(look at the code section)</p>
It is always important and useful to add plentiful comments to your code to make it easy to understand, especially since you are attempting to provide a tutorial. Nice work.
<p>Thank you for the help, i'm gonna had the comments.</p>

About This Instructable

2,212views

58favorites

License:

More by CarlosOliveira:Arduino Uno Tutorial #2 - The Buzzer Song Arduino Uno Tutorial #1 - Basic blink program 
Add instructable to: