Skip to content

Instantly share code, notes, and snippets.

@izzuddin91
Created May 28, 2026 13:21
Show Gist options
  • Select an option

  • Save izzuddin91/4ac2fc4f3dad4e3dae03f6dfee61c509 to your computer and use it in GitHub Desktop.

Select an option

Save izzuddin91/4ac2fc4f3dad4e3dae03f6dfee61c509 to your computer and use it in GitHub Desktop.
ESP32 - test for relay
#include <Arduino.h>
#include <ThreeWire.h>
#include <RtcDS1302.h>
#define PIN_CLK D5
#define PIN_DAT D7
#define PIN_RST D8
#define RELAY_PIN D1 // Relay control pin
ThreeWire myWire(PIN_DAT, PIN_CLK, PIN_RST);
RtcDS1302<ThreeWire> Rtc(myWire);
bool relayTriggered = false;
void setup()
{
pinMode(D1, OUTPUT);
}
void loop()
{
digitalWrite(D1, LOW); // ON for active LOW relay
delay(2000);
digitalWrite(D1, HIGH); // OFF
delay(2000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment