Ok guys I’m new to this so sorry for dumb questions. I used Arduino before and what I needed worked fine but I am having the hardest time getting this ESP 32 to do anything. I have tried uploading in particle IDE and also Ardruino IDE with no luck. What I need is for the program to open each relay for 12 mins each, one at a time when board is powered on then stop program. I am using the NCD4 relay with a PR54-6 (esp32) electron board.
Here is the code I used.
Copy code
`// Define the GPIO pins for the relays
#define RELAY1_PIN 5
#define RELAY2_PIN 18
#define RELAY3_PIN 19
#define RELAY4_PIN 21
// Define the time each relay will be active in milliseconds
#define RELAY_ON_TIME 12 * 60 * 1000 // 12 minutes
void setup() {
// Initialize serial communication
Serial.begin(115200);
// Initialize the relay pins as outputs
pinMode(RELAY1_PIN, OUTPUT);
pinMode(RELAY2_PIN, OUTPUT);
pinMode(RELAY3_PIN, OUTPUT);
pinMode(RELAY4_PIN, OUTPUT);
// Ensure all relays are off at the start
digitalWrite(RELAY1_PIN, LOW);
digitalWrite(RELAY2_PIN, LOW);
digitalWrite(RELAY3_PIN, LOW);
digitalWrite(RELAY4_PIN, LOW);
}
void loop() {
// Activate Relay 1
Serial.println(“Relay 1 ON”);
digitalWrite(RELAY1_PIN, HIGH);
delay(RELAY_ON_TIME);
Serial.println(“Relay 1 OFF”);
digitalWrite(RELAY1_PIN, LOW);
// Activate Relay 2
Serial.println(“Relay 2 ON”);
digitalWrite(RELAY2_PIN, HIGH);
delay(RELAY_ON_TIME);
Serial.println(“Relay 2 OFF”);
digitalWrite(RELAY2_PIN, LOW);
// Activate Relay 3
Serial.println(“Relay 3 ON”);
digitalWrite(RELAY3_PIN, HIGH);
delay(RELAY_ON_TIME);
Serial.println(“Relay 3 OFF”);
digitalWrite(RELAY3_PIN, LOW);
// Activate Relay 4
Serial.println(“Relay 4 ON”);
digitalWrite(RELAY4_PIN, HIGH);
delay(RELAY_ON_TIME);
Serial.println(“Relay 4 OFF”);
digitalWrite(RELAY4_PIN, LOW);
}`
Any help would be great.