11-27-2013 04:31 PM
Hi, LabVIEW friends
I want to let user click and hold a button for a few seconds in order to turn on an equipment. Using shift register and history element I can make it work. I am wondering how to implement it with Event structur and case. Which event I should choose? mouse up?
I attached the test code as well.
thank you.
Solved! Go to Solution.
11-27-2013 04:50 PM
I'm sure there are many possible solutions, but here's one way to do it with an event structure. The button's mechanical action is "Switch until released." Pushing the button turns off the output, and sets the event structure timeout to some amount of time. The timeout event switches the output to true. Any other event sets the timeout value back to -1. Unfortunately it looks like the snippet tool messed up the image, so the VI is attached as well.
12-02-2013 04:15 PM
Thank you very much, nathand. it is a very good solution.
I have another question then. if I already have timeout event handling some other process, how can I do the same "hold" thing? or can I have two "timeout" event (maybe not)?
best regards
CQ
12-02-2013 05:38 PM
CQ_Li wrote:I have another question then. if I already have timeout event handling some other process, how can I do the same "hold" thing? or can I have two "timeout" event (maybe not)?
It depends a little bit what is happening in the other timeout and how often it executes.
In the simples sceanrio, you can place a case structure in the timeout case and wire the current switch until released button terminal to the case selector. Place the current timeout code in the TRUE case and the other timeout stuff in the false case.
12-04-2013 03:00 PM
CQ_Li wrote:I have another question then. if I already have timeout event handling some other process, how can I do the same "hold" thing? or can I have two "timeout" event (maybe not)?
Here's a way you can simulate an additional timeout using a notifier and a user event. This has the same behavior as the previous version.