Take exactly these lines out of your top posted code:
if (tankempty == LOW && ohtankfull == HIGH) {
motorState = 3;//turns off.
counterFunction(motorState);
}
if (tankempty == LOW && ohtanklow == LOW) {
motorState = 4;//turns on.
counterFunction(motorState);
}
if (tankempty == HIGH && ohtanklow == LOW ) {
motorState = 3;// not pressed.
counterFunction(motorState);
}
Serial.println(motorState);
and replace them with these lines:
// fix the following lines, if needed, for what means 0 and 5 volts
bool ohTankFull = digitalRead(ohtankfull);
bool ohTankLow = !digitalRead(ohtanklow);
bool tankOK = digitalRead(tankempty);
// select reset Pump 2 status:
static bool okToPump = true;
if (ohTankFull)
okToPump = false;
if (ohTankLow)
okToPump = true;
bool motorUp = okToPump && tankOK;
digitalWrite(motorUpPin, motorUp);
if (motorUp)
Serial.println("Pump 2 is OFF...");
else
Serial.println("Pump 2 is ON:...");
Please read the comment and adjust the logical polarity of the reports from you sensors. Here's where some better names and hiding the 0, 5 volt LOW and HIGH stuff would help.
The pump can be on or off at reset, that is to say ready to run or not if there is fluid available
That's beyond tapped out for me. You have not shown any interest, so I'm just having fun.
a7