LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

timed event inside event structure inside loop

Solved!
Go to solution

Hello all,

 

I'm a little new with labview. I have problems with nested loop structures and by reading more posts I've lerned that it is wrong. What I'm trying to do is turn on and off  a led every second until another case is selected with a button. I have a case structure inside a loop. thaks a lot.

0 Kudos
Message 1 of 14
(8,049 Views)

Sounds like you want a state machine with an event handler.

Did you want to post what you have?

0 Kudos
Message 2 of 14
(8,039 Views)

I have this tab control. The led is supposed to blink until I press the card button. thanks a lot. 

0 Kudos
Message 3 of 14
(8,035 Views)

Your VI basically works.

 

But instead of having a separate loop, why don't you use the timeout case of the event structure to toggle the boolean.  Store the LED's current value in a shift register, when the timeout value of 1000 msec occurs, it will do a NOT operation on that boolean to flip it.

0 Kudos
Message 4 of 14
(8,025 Views)

actually it works fine with one loop as you say, but when I use a second loop (inside the case structure) the value change takes a lot of time. could you please send me the code of the solution you´re telling me? thanks.

0 Kudos
Message 5 of 14
(8,020 Views)

Like this.

 

Note:  I don't have your enum typedef, and some of those constants are not typedef'd.  I had to recreate some of them and I'm not sure I have your original order for your state machine.  It is also very odd to have an tab control be an indicator, and be controlled by the program.  Usually Tab controls are Controls, and serve as an organizer for different groups of controls that a user would want to see at once.

0 Kudos
Message 6 of 14
(8,007 Views)

@salgadoc wrote:

actually it works fine with one loop as you say, but when I use a second loop (inside the case structure) the value change takes a lot of time. could you please send me the code of the solution you´re telling me? thanks.


Something like this


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 14
(8,002 Views)

thanks to both, Ravens Fan and crossrulz. That was very helpful. How ever, trying to implement that configuration to my proyect (much bigger project) I found another issue. What I'm trying to do is view 3 different images inside an image rig, this images change every 3 seconds. Meanwhile, the LED should blink every second. The loop should do this until I push de Card button.

0 Kudos
Message 8 of 14
(7,964 Views)

So where are you stuck?

 

We can't help solve a more complicated problem than you've already shown if you don't show us the new problem.

0 Kudos
Message 9 of 14
(7,959 Views)

Sorry, here are my file with the two controls. thanks

Download All
0 Kudos
Message 10 of 14
(7,954 Views)