#define BUZZER_PIN 12 // Define the digital pin for the buzzer (replace with your actual pin)
void setup() {
// Initialize serial monitor (adjust baud rate if needed)
Serial.begin(115200);
// Set the buzzer pin as output
pinMode(BUZZER_PIN, OUTPUT);
}
void loop() {
// Turn on the buzzer and print message
Serial.println("Buzzer on!");
tone(BUZZER_PIN, 1000); // Use tone for active buzzers or adjust for passive ones
delay(1000);
// Turn off the buzzer and print message
Serial.println("Buzzer off!");
noTone(BUZZER_PIN); // Stop tone for active buzzers
delay(3000);
}