const int buzzerPin=2; // Define the buzzer pin
void setup()
{
pinMode(buzzerPin, OUTPUT); // Set the buzzer pin as an output
}
void loop()
{
// Play a tone at 1000 Hz for 500 milliseconds
tone(buzzerPin,250);
delay(2000);
// Turn off the tone
noTone(buzzerPin);
delay(1000);
}