LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to make a delay in the true case of a case loop, without affecting the false case?

Solved!
Go to solution

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 🙂

0 Kudos
Message 1 of 10
(4,211 Views)

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.

Message 2 of 10
(4,198 Views)

Hi remapears,

 

when you put something inside the TRUE case of a case structure it will NOT affect the FALSE case! (THINK DATAFLOW!)

 

If your VI behaves different you shoul dattach your VI so we can examine it…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 10
(4,194 Views)

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..

0 Kudos
Message 4 of 10
(4,178 Views)

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.

0 Kudos
Message 5 of 10
(4,174 Views)

Yes i am using it..

okay i'll try 

0 Kudos
Message 6 of 10
(4,170 Views)
Solution
Accepted by topic author remapears

@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.)

Message 7 of 10
(4,164 Views)

Wow your vi worked!

Thank you so much for your help, 

0 Kudos
Message 8 of 10
(4,151 Views)

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).

Message 9 of 10
(4,143 Views)

Got it!

You are awesome 😄

0 Kudos
Message 10 of 10
(4,136 Views)