04-27-2016 12:51 PM - edited 04-27-2016 12:52 PM
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.
Solved! Go to Solution.
04-27-2016 01:00 PM
Sounds like you want a state machine with an event handler.
Did you want to post what you have?
04-27-2016 01:10 PM
I have this tab control. The led is supposed to blink until I press the card button. thanks a lot.
04-27-2016 02:13 PM
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.
04-27-2016 02:23 PM - edited 04-27-2016 02:23 PM
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.
04-27-2016 02:56 PM
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.
04-27-2016 03:00 PM - edited 04-27-2016 03:00 PM
@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
04-28-2016 08:48 AM
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.
04-28-2016 09:00 AM
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.
04-28-2016 09:16 AM
Sorry, here are my file with the two controls. thanks