Arduino UNO R3 using two outputs dependent to different inputs

@Syed have you looked at the wokwi in #17 above, or the code in #38?

It seems like a solution: If you haven’t, take a close look at both.

If you have looked at those posts and sim and code, and either do not understand how it might solve your problem, or it isn’t the problem you are trying to solve, please explain a bit more. Or ask questions.

Please confirm:

The overhead tank pump should run until the tank is full, then stop until it is empty. Rinse and repeat.

Except if there is no fluid to draw from the other tank.

This is what can be deduced, by me anyway, from the various evidence in your posts and code.

You have stated that the logic controlling the first tank and pump are functioning to your desires, all that is needed is the control of the second pump.

You wedged it into your counterFunction and left with doing some ambidpguous useless print statement “motor on” which motor, ya know.

It can be handled directly from the inputs to the relay in a few lines of code I have demonstrated.

a7