Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define R1p 4 //Relay 1 is ESP32 GPIO 4
- #define R2p 16 //Relay 2 is ESP32 GPIO 16
- #define R3p 17 //Relay 3 is ESP32 GPIO 17
- #define R4p 18 //Relay 4 is ESP32 GPIO 18
- #define R5p 19 //Relay 5 is ESP32 GPIO 19
- #define R6p 21 //Relay 6 is ESP32 GPIO 21
- #define R7p 22 //Relay 7 is ESP32 GPIO 22
- #define R8p 23 //Relay 8 is ESP32 GPIO 23
- void setup() {
- pinMode(R1p, OUTPUT); //Sets specified pin as an output
- pinMode(R2p, OUTPUT); //Sets specified pin as an output
- pinMode(R3p, OUTPUT); //Sets specified pin as an output
- pinMode(R4p, OUTPUT); //Sets specified pin as an output
- pinMode(R5p, OUTPUT); //Sets specified pin as an output
- pinMode(R6p, OUTPUT); //Sets specified pin as an output
- pinMode(R7p, OUTPUT); //Sets specified pin as an output
- pinMode(R8p, OUTPUT); //Sets specified pin as an output
- digitalWrite(R1p, HIGH); //Turns relay module off initially since it is active high
- digitalWrite(R2p, HIGH); //Turns relay module off initially since it is active high
- digitalWrite(R3p, HIGH); //Turns relay module off initially since it is active high
- digitalWrite(R4p, HIGH); //Turns relay module off initially since it is active high
- digitalWrite(R5p, HIGH); //Turns relay module off initially since it is active high
- digitalWrite(R6p, HIGH); //Turns relay module off initially since it is active high
- digitalWrite(R7p, HIGH); //Turns relay module off initially since it is active high
- digitalWrite(R8p, HIGH); //Turns relay module off initially since it is active high
- }
- void loop() {
- digitalWrite(R1p, LOW); //Turns relay module off initially since it is active high
- digitalWrite(R2p, LOW); //Turns relay module off initially since it is active high
- digitalWrite(R3p, LOW); //Turns relay module off initially since it is active high
- digitalWrite(R4p, LOW); //Turns relay module off initially since it is active high
- digitalWrite(R5p, LOW); //Turns relay module off initially since it is active high
- digitalWrite(R6p, LOW); //Turns relay module off initially since it is active high
- digitalWrite(R7p, LOW); //Turns relay module off initially since it is active high
- digitalWrite(R8p, LOW); //Turns relay module off initially since it is active high
- delay(5000);
- digitalWrite(R1p, HIGH); //Turns relay module off initially since it is active high
- digitalWrite(R2p, HIGH); //Turns relay module off initially since it is active high
- digitalWrite(R3p, HIGH); //Turns relay module off initially since it is active high
- digitalWrite(R4p, HIGH); //Turns relay module off initially since it is active high
- digitalWrite(R5p, HIGH); //Turns relay module off initially since it is active high
- digitalWrite(R6p, HIGH); //Turns relay module off initially since it is active high
- digitalWrite(R7p, HIGH); //Turns relay module off initially since it is active high
- digitalWrite(R8p, HIGH); //Turns relay module off initially since it is active high
- delay(5000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement