/* Arduino tutorial - Buzzer / Piezo Speaker
More info and circuit: http://www.ardumotive.com/how-to-use-a-buzzer-en.html
Dev: Michalis Vasilakis // Date: 9/6/2015 // www.ardumotive.com */
const int buzzer = 10; //buzzer to arduino pin 9
void beep(int n)
{
for(int i=0;i<n;i++)
{ tone(buzzer, 440); // Send 1KHz sound signal...
delay(500); // ...for 1 sec
noTone(buzzer); // Stop sound...
delay(500); }
}
void setup(){
pinMode(buzzer, OUTPUT); // Set buzzer - pin 9 as an output
}
void loop(){
beep(1);
delay(2000); // ...for 1sec
}