safwan092

Untitled

Aug 16th, 2018
139
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. bool d1 = 0;
  2. bool d2 = 0;
  3. bool d3 = 0;
  4. bool d4 = 0;
  5.  
  6. int wires[4] = {8, 9, 10, 11};
  7.  
  8. void setup() {
  9. Serial.begin(9600);
  10.  
  11. for (int i = 0; i < 4; i++) { //15
  12. pinMode(wires[i], INPUT);
  13. Serial.print(wires[i]);
  14. Serial.print(",");
  15. }
  16. }
  17.  
  18. void loop() {
  19. d1 = digitalRead(wires[0]);
  20. d2 = digitalRead(wires[1]);
  21. d3 = digitalRead(wires[2]);
  22. d4 = digitalRead(wires[3]);
  23. delay(50);
  24.  
  25. if (d1 == 0 && d2 == 0 && d3 == 0 && d4 == 0 ) {
  26. Serial.println("[1] ----> *** OPEN ***");
  27. }
  28.  
  29. else {
  30. Serial.println("[#] ----> System Closed");
  31. }
  32.  
  33. delay(50);
  34. }
RAW Paste Data