Introduction: Beep Piezo Buzzer in Certain Invervals With Arduino Uno and Tone() Library.

This instruction is aimed to make you understand how a Piezo Buzzer works with an Arduino Uno. The result should be some varies tone generated by Arduino within defined intervals and goes to Piezo Buzzer.

Step 1: Materials

1. Piezo Buzzer

2. Two (2) jumper wires

Step 2: Wiring

    1. Connect "+" Pin of Piezo Buzzer to Pin 8 of Arduino Uno

    2. Connect "-" Pin of Piezo Buzzer to Pin GND of Arduino Uni

    Step 3: Programming

    const int buzzerPin = 8; //Where your '+' of Buzzer goes to
    const int freq1 = 220; //Low Note A const int freq2 = freq1 * 2; //Med const int freq3 = freq1 * 3; //Hi const int freq4 = freq1 * 4; //Very Hi boolean play = true; void setup() { pinMode(buzzerPin, OUTPUT); }

    void loop() { if (play == true) { makeBeep(1, 1, freq1); // Desc: in 1 second ahead beep an "A" note in 1 second length makeBeep(5, 1, freq1); makeBeep(5, 1, freq2); makeBeep(1, 1, freq3); makeBeep(1, 5, freq4); } play = false; //uncomment if you want to play over and over } void makeBeep(int intervalSeconds, int howlongSeconds, int freq) { delay(intervalSeconds * 1000); tone(buzzerPin, freq, howlongSeconds * 1000); }