Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void WaterController()
- {
- if(read_s1_value < PlantS1)
- {
- tap_motor_sensor1.open_damper(); //turn one side solenoid with motortimeout delay
- electric_tap_motor1 = HIGH ;
- if(digitalRead(PumpPin) == LOW);
- {
- digitalWrite(PumpPin,HIGH);
- }
- }
- else
- {
- tap_motor_sensor1.close_damper(); //turn other side solenoid with motortimeout delay
- electric_tap_motor1 = LOW ;
- }
- if(read_s2_value < PlantS2)
- {
- tap_motor_sensor2.open_damper(); //turn one side solenoid with motortimeout delay
- electric_tap_motor2 = HIGH ;
- if(digitalRead(PumpPin) == LOW)
- {
- digitalWrite(PumpPin,HIGH);
- }
- }
- else
- {
- tap_motor_sensor2.close_damper(); //turn other side solenoid with motortimeout delay
- electric_tap_motor2 = LOW ;
- }
- if(read_s3_value < PlantS3)
- {
- tap_motor_sensor3.open_damper(); //turn one side solenoid with motortimeout delay
- electric_tap_motor3 = HIGH ;
- if(digitalRead(PumpPin) == LOW)
- {
- digitalWrite(PumpPin,HIGH);
- }
- }
- else
- {
- tap_motor_sensor3.close_damper(); //turn other side solenoid with motortimeout delay
- electric_tap_motor3 = LOW ;
- }
- if(read_s4_value < PlantS4)
- {
- //tap_motor_sensor4.open_damper(); //turn one side solenoid with motortimeout delay
- electric_tap_motor4 = HIGH ;
- if(digitalRead(PumpPin) == LOW)
- {
- digitalWrite(PumpPin,HIGH);
- }
- }
- else
- {
- // tap_motor_sensor4.close_damper(); //turn other side solenoid with motortimeout delay
- electric_tap_motor4 = LOW ;
- }
- // check if all Tap is OFF then turn OFF the Pump
- if(electric_tap_motor1 == LOW && electric_tap_motor2 == LOW && electric_tap_motor3 == LOW && electric_tap_motor4 == LOW)
- {
- digitalWrite(PumpPin,LOW);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement