![]() |
|
Delay Relay - Printable Version +- Smart Home Automation Forum (https://www.kincony.com/forum) +-- Forum: Technical Support (https://www.kincony.com/forum/forumdisplay.php?fid=1) +--- Forum: Development (https://www.kincony.com/forum/forumdisplay.php?fid=4) +--- Thread: Delay Relay (/showthread.php?tid=8580) |
Delay Relay - abbasgts - 09-24-2025 Subject: Request: Sequential 8-relay example for F8 (ESP32-S3), 1.5s step, reverse on shutdown Message: Hello KinCony team, I am using the KinCony F8 (ESP32-S3) board with the PCF8575 I/O expander to control 8 relays. I would like to have an Arduino example that performs the following: • Sequential ON: Relay1 → Relay8, with 1.5 seconds delay between each relay. • Sequential OFF: Relay8 → Relay1, with the same 1.5 seconds delay. • Arduino IDE, using I2C with SDA = GPIO8, SCL = GPIO18, and PCF8575 address = 0x24 (please confirm). My questions are: 1. What is the exact GPIO mapping for each relay on the F8 hardware revision? 2. Do you have an official Arduino example implementing this sequence? 3. If there is a recommended library or header file for this board, could you please share the link? Here is a sample code I tested so far (for reference): #include <Wire.h> #include <PCF8575.h> #define I2C_SDA 8 #define I2C_SCL 18 #define PCF8575_ADDR 0x24 PCF8575 pcf(PCF8575_ADDR); const uint8_t RELAY_PINS[8] = {P0, P1, P2, P3, P4, P5, P6, P7}; void setup() { Serial.begin(115200); if (!pcf.begin(I2C_SDA, I2C_SCL)) { Serial.println("PCF8575 not found!"); while (1); } for (int i = 0; i < 8; i++) { pcf.write(RELAY_PINS[i], HIGH); // OFF at start } } void loop() { // Sequential ON for (int i = 0; i < 8; i++) { Serial.print("Relay ON: "); Serial.println(i+1); pcf.write(RELAY_PINS[i], LOW); delay(1500); } // Sequential OFF for (int i = 7; i >= 0; i--) { Serial.print("Relay OFF: "); Serial.println(i+1); pcf.write(RELAY_PINS[i], HIGH); delay(1500); } } RE: Delay Relay - admin - 09-24-2025 your question already repied in another thread. |