Programming Examples
Arduino program to interface buzzer with Arduino board to buzz on off with the delay of 1sec
Write a program to interface buzzer with Arduino board to buzz on off with the delay of 1sec
const int BUZZER = 9;//buzzer to arduino pin 9
void setup()
{
pinMode(BUZZER, OUTPUT);//7 Set buzzer - pin 9 as an output
}
void loop()
{
tone(BUZZER, 1000); // Send 1KHz sound signal...
delay(1000);//for 1 sec
noTone(BUZZER); //Stop sound...
delay(1000); //..for 1sec
}
Output