Hello Arduino comunity, so im doing a code and I need the code do this:
Count 1 minute with millis
After count that minute, check a sensor
If sensor is minor than X value start another counter and inside that counter condition (because is millis) read a sensor and turn ON a rele until the sensor reach a value greater than X, after that restart the first counter and again again again.
I dont want the code, I just want to know if it is possible and maybe some guidance, thank you comunity
So what happens when the minute timeout happens and the sensor is >= X? Wait another minute before checking? Or keep looking at it constantly until it's < X?
Edit: assuming the latter case:
setup:
make relay inactive
start 1 minute sensor timer
loop:
if relay is inactive and sensor timer has expired
if sensor input < X
make relay active
end if
end if
if relay is active and sensor input >= X
restart 1 minute sensor time
make relay inactive
fi
If you only want the sensor checked for < X every minute, simply restart the sensor timer as the first step in the first outer if, just like in the second outer if.