// PROGRAM DESCRIPTION VIDEO AT http://www.youtube.com/@himanshusingheducationist7700
// ARDUINO UNO MICROCONTROLLER BASED PROGRAMS
// FOR O LEVEL COURSE BY NIELIT
// Internet of Things and Its Applications M1-R5
// PROGRAM BY HIMANSHU SINGH
// PROGRAM :4
// Write a program to interface buzzer with Arduino board to buzz on/off with the delay of1sec
// Define the pin to which the buzzer is connected
const int buzzerPin = 9; // You can change this to the actual pin number you are using
void setup()
{
// Set the buzzer pin as an OUTPUT
pinMode(buzzerPin, OUTPUT);
}
void loop() {
// Turn the buzzer on
digitalWrite(buzzerPin, HIGH);
tone(9,798,2000);
// Wait for 1 second
delay(1000);
// Turn the buzzer off
digitalWrite(buzzerPin, LOW);
// Wait for 1 second
delay(1000);
}