09-20-2015 11:54 AM
Hello,
I'm making a mini project, where i have to, when the input is true, make a delay (10s) before the output can be true, therefore i've used a case loop and used the wait function in the true case only, but it seems that it affects also the false case..
Please help!
Thanks for your time 🙂
Solved! Go to Solution.
09-20-2015 12:01 PM - edited 09-20-2015 12:10 PM
Attaching your VI would be much clearer to troubleshoot the problem than words.
Obviously, you are doing something wrong, but your description is very blurry and ambiguous.
What is a "case loop"?
What is the "output"? (digital IO, LED on the front panel, etc.)
What is the "input"? (digital IO, switch on the front panel, etc.)
What causes the input to go true?
It is also not typically a good idea to place long delays in active code, potentially stalling the interactive parts. Use a state machine instead.
09-20-2015 12:02 PM
09-20-2015 12:15 PM
Hey there, thanks for your quick interventions
I've attached the vi file, it has:
* 1 Boolean button: basically ON or OFF
* 1 LED: that should light up, after 10s from when the button has been pushed (ON), after that if the button is turned OFF, the LED should turn off also immediately..
(not after 10s also)..
Hope this is a bit clearer..
09-20-2015 12:20 PM - edited 09-20-2015 12:28 PM
Your code is one shot. The button gets read only once. Are you using continuous run?
Try to use the timeout case of an event structure instead.
09-20-2015 12:24 PM
Yes i am using it..
okay i'll try
09-20-2015 12:27 PM - edited 09-20-2015 12:39 PM
@remapears wrote:
Yes i am using it..
Using what, exactly? (event structure? Continuous run?, something else?)
Try something like the attached.
("Continuous run" is a debugging feature, not a way to run a VI normally, so don't do that.)
09-20-2015 12:33 PM
Wow your vi worked!
Thank you so much for your help, altenbach!
i was using "running continuously"..
i've never used this event structure before, i still have lots to learn ..
Thanks again guys (y)
09-20-2015 12:41 PM - edited 09-20-2015 12:42 PM
Sorry, the VI had a small bug, I attached a new version above.
(We need to set the timeout back to infinite (-1) after a timeout has occurred, esle the loop will continue to spin, using more CPU than needed).
09-20-2015 12:44 PM
Got it!
You are awesome 😄