Commit 20af1a0bfe5979d3d70b841f1b7771c77e1a12d9

Authored by henyxia
1 parent db501df7

Added redundancy checks

Showing 1 changed file with 21 additions and 8 deletions   Show diff stats
main.ino
1   -int led = 7;
2   -int ctrl = 8;
  1 +int ctrlPump1 = 5;
  2 +int ctrlPump2 = 6;
  3 +int ctrlHeat1 = 7;
  4 +int ctrlHeat2 = 8;
  5 +int pump = 9;
  6 +int heat = 10;
3 7  
4 8 void setup()
5 9 {
6   - pinMode(led, OUTPUT);
7   - pinMode(ctrl, INPUT);
  10 + pinMode(ctrlPump1, INPUT);
  11 + pinMode(ctrlPump2, INPUT);
  12 + pinMode(ctrlHeat1, INPUT);
  13 + pinMode(ctrlHeat2, INPUT);
  14 + pinMode(pump, OUTPUT);
  15 + pinMode(heat, OUTPUT);
8 16 }
9 17  
10 18 void loop()
11 19 {
12   - if(digitalRead(ctrl) == HIGH)
13   - digitalWrite(led, LOW);
  20 + if((digitalRead(ctrlPump1) == HIGH) && digitalRead(ctrlPump2))
  21 + digitalWrite(pump, LOW);
14 22 else
15   - digitalWrite(led, HIGH);
16   - delay(1000);
  23 + digitalWrite(pump, HIGH);
  24 +
  25 + if((digitalRead(ctrlHeat1) == HIGH) && digitalRead(ctrlHeat2))
  26 + digitalWrite(heat, LOW);
  27 + else
  28 + digitalWrite(heat, HIGH);
  29 + delay(1000);
17 30 }
... ...