Here's the catch, what I want on the output for the autodrinker which is like elkay bottle filler. The autodrinker has a filter status that has a green, yellow, and red led, which is connected to the water flow sensor, I already fixed that, but when the led turned to red and I put the bottle on the ultrasonic sensor (HC-SR04), the 5v relay module activates the solenoid valve (yf-s201) which activates the water flow.
So, what I want is when the led turned to red, relay and solenoid valve is still off even when you put the bottle on the sensor, so the water flow will not activate, but it will activate again if the person press the reset button on the arduino mega 2560, the green led will turn on and so the relay & solenoid valve.
see the attached code
drinkinhg_fount.ino (2.55 KB)
drinkinhg_fount.ino (2.55 KB)