Hello,
I need to check a Variable for 5 Sec. so that the Sensor is not activated by mistake.
the Programm should only run if the Sensor gets the Signal for that time.
Should i use a Sub-Programm?
Hello,
I need to check a Variable for 5 Sec. so that the Sensor is not activated by mistake.
the Programm should only run if the Sensor gets the Signal for that time.
Should i use a Sub-Programm?
Kurt.stahl,
You could monitor the input in a thread.
when the input goes high start a timer
when the input goes low stop and reset the timer
remember to add a sync() into the thread
then in your program
check if the input is high and timer to be equal or grater than 5 sec.
so if the input is activated for less than 5 sec the if statement in the prog won’t be true because the timer will keep being reset to 0
if the input is activated for 5 sec or more the timer will start continue to count until the Digital input is low again. (or you stop the timer somewhere else in the program).