Advertisement
J0N4TH4NGR4NDM0NT

DUAL_FLOAT_SWITCH_V.0

May 26th, 2022
1,075
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #define SWH 4
  2. #define SWL 5
  3. #define REL 6
  4.  
  5. void setup() {
  6. pinMode(SWH, INPUT);
  7. pinMode(SWL, INPUT);
  8. pinMode(REL, OUTPUT);
  9. }
  10.  
  11. void loop() {
  12.  
  13.   if (digitalRead(SWH) == HIGH && digitalRead(SWL) == HIGH && (REL) == LOW)
  14. {
  15.   digitalWrite(REL, LOW);
  16. }
  17.   if (digitalRead(SWH) == LOW && digitalRead(SWL) == HIGH && (REL) == LOW)
  18. {
  19.   digitalWrite(REL, LOW);
  20. }
  21.   if (digitalRead(SWH) == LOW && digitalRead(SWL) == LOW && (REL) == LOW)
  22. {
  23.   digitalWrite(REL, HIGH);
  24. }
  25.   if (digitalRead(SWH) == LOW && digitalRead(SWL) == HIGH && (REL) == HIGH)
  26. {
  27.   digitalWrite(REL, HIGH);
  28. }
  29. }
Advertisement
RAW Paste Data Copied
Advertisement