How to make relay work only when water level 1% to fully 100%.
When the water decreases in the tank from 100% to 1% the fill pump has not turned on, but when the water reaches 1% the fill pump must be on until the water reaches the tank 100%
can someone give me a sample code of the command ?
my goal is exactly what you mean, strangely in this case when the water level rises from 1% the fill pump turns on and off when it reaches 100%, and comes back on when the water level drops from 100% to 1%
maybe you can help?
I want when the water level reaches 1% the water pump turns on for 5 seconds to check the water rate in the inlet pipe, if there is a water rate then the pump turns on, if there is no water rate then the pump turns on for 5 seconds then turns off 5 seconds until there is a water rate in the inlet pipe .
That's not everything, but let's not go back and forth.
Consider using a "flag" (or "flag bit"), a boolean.
You can't have the supply line On when flag is asserted (a condition).
if flag is asserted and level == 1% then flag = !flag, turn on the supply.
The problem (I think) is that there is at least one other requirement such that there is also a check to verify that water is flowing from the inlet pump.
It looks to me as though a rewrite as a state machine would make things easier, but I think the OP may struggle with the refactoring.