08-23-2010 09:36 PM
Dear all,
I am using a event structure to sense for change in state of a indicator. Right now, i am wondering is there any way i can monitor this change in state within a time interval?
Meaning how can i fire the event only when the change in state is sufficiently long ( say 5 sec), if it there is a change in state but subsequently return back to normal state (less than 5 sec), the event will not fire.
Thanks and hope anyone can give me some hints on how to do that?
Solved! Go to Solution.
08-24-2010 02:05 AM
08-24-2010 02:40 AM
Hey Joven.
You could try something like this where you monitor the mouse down and mouse up cases on the same boolean. If the time between the two is greater then 3 then you can execute some code in the case structure.
- Rkll
08-24-2010 03:22 AM
Hi,
I am sure we can help you better when you just post a small code what you want to do.
08-24-2010 01:11 PM
Here is some simple code that will compare a boolean to its last state. If changed, it waits 2 seconds and reads the boolean again. If still changed, it displays a message. You can adapt to your use. Written in LV2009.
I used regular polling. I tried using dynamic events, but ran into a problem with the dynamic event locking the front panel so that I could not change the boolean after the event was fired. When using dynamic events, there is no checkbox to disable or enable front panel activity, like there is in a regular event. So during the two second wait, I could not change the boolean.
08-24-2010 01:57 PM
Here is how I would do it so the code never gets stuck.
08-24-2010 02:07 PM
Tim, I think you need to re-read the original post. It is an indicator whose change fires an event. The OP doesn't want to prevent another change, he wants to fire the event only if the change stays for 5 seconds or more, i.e, it doesn't change back after 4 seconds.
08-24-2010 02:36 PM
Sorry for not reading this completely. Here is a version that works and does not get stuck waiting.
08-24-2010 02:45 PM
Yes, that's how it is supposed to work. I think I like your solution better than mine.
08-24-2010 10:56 PM
Dear asest and Tbob,
Thanks all for your help. You have given me some ideas on how to proceed from there.