I have a push button with mechanical action set to switch until release(so that it gives an impulse boolean ON for 1 sec). I want to know a way so that the case structure remains active for a specified time after the push button goes off.
Thanks in advance.
已解决! 转到解答。
Okay, I am trying to implement a bidirectional visitor counter in a room using two PIR sensors wired to a DAQ, the two sensors are kept 1m apart along a single line, and depending on what IR sensor is cut first the counter should either increment or decrement, for entry and exit respectively. However whatever logic i so far used results in negation of the two cases so the counter yields zero. So i am forced to use two doors for entry or a partition of the door to maintain a count. So right now, im thinking of some way to disable one IR sensor for some time while the other is being cut.
I'd use a shift register to store the state of the inner & outer sensors and an Event structure timeout case to address the 1 second delay. Like this:
The snipppet didn't show what I wanted very well, but the VI is attached.
If you are interfacing to real sensors, you probably need to poll them at regular intervals and an event structure is not the solution. A simple state machine would suffice.
You have several states, e.g.:
if you are in state 1, simply wait for any sensor to trigger and proceed to the relevant state
if you are in state 2, and sensor 1 triggers again, don't increment, because the person has left. if sensor 2 triggers, increment the count and go back to state 1.
if you are in state 3, and sensor 2 triggers again, ignore. If sensor 1 triggers, decrement the count and go back to state 1.
... or similar.
This is perfect! You have implemented the logic so flawlessly! I have so much more to learn... Thank you so much!
altenbach's comment is important to note. My answer relied on the boolean controls while your situation relies on digital inputs that won't trigger an Event structure by themselves.
I can wire booleans to the inputs from daq and use local variables now, can't I?