Created
May 28, 2026 13:21
-
-
Save izzuddin91/4ac2fc4f3dad4e3dae03f6dfee61c509 to your computer and use it in GitHub Desktop.
ESP32 - test for relay
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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