Advertisement
noam76

waterControl

Jan 23rd, 2018
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.68 KB | None | 0 0
  1. void WaterController()
  2. {
  3.  if(read_s1_value < PlantS1)
  4.  {
  5.   tap_motor_sensor1.open_damper(); //turn one side solenoid with motortimeout delay
  6.   electric_tap_motor1 = HIGH ;
  7.   if(digitalRead(PumpPin) == LOW);
  8.   {
  9.    digitalWrite(PumpPin,HIGH);
  10.   }
  11.  }
  12.  else
  13.  {
  14.   tap_motor_sensor1.close_damper(); //turn other side solenoid with motortimeout delay
  15.   electric_tap_motor1 = LOW ;
  16.  }
  17.  
  18.  if(read_s2_value < PlantS2)
  19.  {
  20.   tap_motor_sensor2.open_damper(); //turn one side solenoid with motortimeout delay
  21.   electric_tap_motor2 = HIGH ;
  22.   if(digitalRead(PumpPin) == LOW)
  23.   {
  24.    digitalWrite(PumpPin,HIGH);
  25.   }
  26.  }
  27.  else
  28.  {
  29.   tap_motor_sensor2.close_damper(); //turn other side solenoid with motortimeout delay
  30.   electric_tap_motor2 = LOW ;
  31.  }
  32.  
  33.  if(read_s3_value < PlantS3)
  34.  {
  35.   tap_motor_sensor3.open_damper(); //turn one side solenoid with motortimeout delay
  36.   electric_tap_motor3 = HIGH ;
  37.   if(digitalRead(PumpPin) == LOW)
  38.   {
  39.    digitalWrite(PumpPin,HIGH);
  40.   }
  41.  }
  42.  else
  43.  {
  44.   tap_motor_sensor3.close_damper(); //turn other side solenoid with motortimeout delay
  45.   electric_tap_motor3 = LOW ;
  46.  }
  47.  
  48.  if(read_s4_value < PlantS4)
  49.  {
  50.   //tap_motor_sensor4.open_damper(); //turn one side solenoid with motortimeout delay
  51.   electric_tap_motor4 = HIGH ;
  52.   if(digitalRead(PumpPin) == LOW)
  53.   {
  54.    digitalWrite(PumpPin,HIGH);
  55.   }
  56.  }
  57.  else
  58.  {
  59.  // tap_motor_sensor4.close_damper(); //turn other side solenoid with motortimeout delay
  60.   electric_tap_motor4 = LOW ;
  61.  }
  62.  
  63.  // check if all Tap is OFF then turn OFF the Pump
  64.  if(electric_tap_motor1 == LOW && electric_tap_motor2 == LOW && electric_tap_motor3 == LOW && electric_tap_motor4 == LOW)
  65.  {
  66.   digitalWrite(PumpPin,LOW);
  67.  }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement