Advertisement
hwthinker

relay10A-8ch-esp12f-01-test

Sep 19th, 2023
1,008
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int rly1 = 16;
  2. int rly2 = 14;
  3. int rly3 = 12;
  4. int rly4 = 13;
  5. int rly5 = 15;
  6. int rly6 = 0;
  7. int rly7 = 4;
  8. int rly8 = 5;
  9. int LED_chip = 5;
  10.  
  11. int RLY = 0;
  12. void setup() {
  13.   // initialize digital pin LED_BUILTIN as an output.
  14.   pinMode(rly1, OUTPUT);
  15.   pinMode(rly2, OUTPUT);
  16.   pinMode(rly3, OUTPUT);
  17.   pinMode(rly4, OUTPUT);
  18.   pinMode(rly5, OUTPUT);
  19.   pinMode(rly6, OUTPUT);
  20.   pinMode(rly7, OUTPUT);
  21.   pinMode(rly8, OUTPUT);
  22.   Serial.begin(9600);
  23. }
  24.  
  25. // the loop function runs over and over again forever
  26. void loop() {
  27.   blinkRLY(rly1, "relay 1");  
  28.   blinkRLY(rly2, "relay 2");  
  29.   blinkRLY(rly3, "relay 3");  
  30.   blinkRLY(rly4, "relay 4");  
  31.   blinkRLY(rly5, "relay 5");  
  32.   blinkRLY(rly6, "relay 6");  
  33.   blinkRLY(rly7, "relay 7");  
  34.   blinkRLY(rly8, "relay 8");  
  35. }
  36.  
  37. void blinkRLY(uint8 RLY, String pesan) {
  38.   Serial.println(pesan);
  39.   digitalWrite(RLY, HIGH);  // turn the LED on (HIGH is the voltage level)
  40.   delay(1000);              // wait for a second
  41.   digitalWrite(RLY, LOW);   // turn the LED off by making the voltage LOW
  42.   delay(1000);
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement