value's duration before an event
-
IS there a way to set it so that a somethings happens after a value = X for N seconds?
example:
I am trying to trigger M25 if the value stays NOT zero for longer than 5 seconds. Reason being, I don't want to trigger a pause event at all even if it will resume on it's own. I just want the pause command to be ignored competely if value!=0 is never longer than 5 seconds duration.
if sensors.gpIn[1].value != 0
echo "Pause initiated gpIn[1] =", {sensors.gpIn[1].value}
echo "machine status =", {state.status}
m25 ; pauseThanks in advance!
-
@tekstyle wondering if any experts have some insights to this. thank you
-
@tekstyle can you do a while loop that runs for five seconds once !=0 is met; within the while loop check for the status. If it returns to zero within the while loop then it exits. If the while loop completes, then it was !=0 for longer than five seconds and then can pause.
-
thanks. this works perfect. the only issue I ran into is when I manually pause, it wouldn't always stay paused but automatically resume. on the facebook thread, someone mentioned using daemon.g instead of m581. I'll have to dig a little more to see if this will work better.