#define OVERHEAD_TANK_SENSOR_1 34 // Float switch sensor pin for overhead tank 1
#define OVERHEAD_TANK_SENSOR_2 35 // Float switch sensor pin for overhead tank 2
#define SUMP_TANK_SENSOR_1 23 // Float switch sensor pin for sump tank 1
#define SUMP_TANK_SENSOR_2 22 // Float switch sensor pin for sump tank 2
#define GENERAL_MOTOR_PIN 2
#define HP_MOTOR_PIN 15
void setup() {
pinMode(OVERHEAD_TANK_SENSOR_1, INPUT_PULLUP);
pinMode(OVERHEAD_TANK_SENSOR_2, INPUT_PULLUP);
pinMode(SUMP_TANK_SENSOR_1, INPUT_PULLUP);
pinMode(SUMP_TANK_SENSOR_2, INPUT_PULLUP);
pinMode(GENERAL_MOTOR_PIN, OUTPUT);
pinMode(HP_MOTOR_PIN, OUTPUT);
Serial.begin(9600);
}
void loop() {
int overheadTankStatus1 = digitalRead(OVERHEAD_TANK_SENSOR_1);
int overheadTankStatus2 = digitalRead(OVERHEAD_TANK_SENSOR_2);
int sumpTankStatus1 = digitalRead(SUMP_TANK_SENSOR_1);
int sumpTankStatus2 = digitalRead(SUMP_TANK_SENSOR_2);
if (overheadTankStatus1 == LOW && overheadTankStatus2 == LOW) {
// Overhead tank is full, turn off both motors
digitalWrite(GENERAL_MOTOR_PIN, LOW);
digitalWrite(HP_MOTOR_PIN, LOW);
Serial.println("General Motor:OFF");
Serial.println("OneHP Motor:OFF");
} else {
// Overhead tank is empty, check the sump tank status
if (sumpTankStatus1 == LOW && sumpTankStatus2 == LOW) {
// Sump tank is full, turn on General motor and turn off HP motor
digitalWrite(GENERAL_MOTOR_PIN, HIGH);
digitalWrite(HP_MOTOR_PIN, LOW);
Serial.println("General Motor:ON");
Serial.println("OneHP Motor:OFF");
} else if (sumpTankStatus1 == HIGH && sumpTankStatus2 == HIGH) {
// Sump tank is empty, turn off General motor and turn on HP motor
digitalWrite(GENERAL_MOTOR_PIN, LOW);
digitalWrite(HP_MOTOR_PIN, HIGH);
Serial.println("General Motor:OFF");
Serial.println("OneHP Motor:ON");
} else {
// If any other condition occurs, print "No operation"
Serial.println("No operation");
}
}
delay(1000);
}