#define relayPin 6 // Define pin D1 sebagai output untuk mengontrol relay
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(relayPin, OUTPUT); // Set pin D2 sebagai output
}
void loop() {
// put your main code here, to run repeatedly:
int relayStatus = digitalRead(relayPin); // Baca status relay
Serial.print("Relay Status: ");
Serial.println(relayStatus);
delay(1000); // this speeds up the simulation
digitalWrite( relayPin, HIGH);
delay( 600);
digitalWrite( relayPin, LOW);
delay( 600);
}