const int relay = 18; // Relay control pin on ESP32
void setup() {
Serial.begin(115200); // Start serial communication
pinMode(relay, OUTPUT); // Set relay pin as output
}
void loop() {
// Turn on the relay (LED turns ON if using Normally Open configuration)
digitalWrite(relay, LOW);
Serial.println("Buzz on");
delay(5000); // Keep the LED ON for 5 seconds
// Turn off the relay (LED turns OFF if using Normally Open configuration)
digitalWrite(relay, HIGH);
Serial.println("Buz off");
delay(5000); // Keep the LED OFF for 5 seconds
}