LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

While loop does not execute correctly

Solved!
Go to solution

So I have a for loop inside of a while loop. The while loop does not execute if I don't put a "wait" function inside the for loop. I want to have the wait function outside the for loop but inside the while loop so that I can set the time for the whole loop. How can I do that? I have compared my code with a friends and his does work with the wait function outside the for loop. 

 

The reason I want to do this is because I want the RPM update every time a new LED turns on. 

 

 

0 Kudos
Message 1 of 6
(1,568 Views)

Could you save for LV2019 (or lower)? I don't have 2020.

 

If your while loop doesn't execute (other than first iteration), then there's something in the for loop that makes it hang.

0 Kudos
Message 2 of 6
(1,538 Views)

@GG00 wrote:

 

The reason I want to do this is because I want the RPM update every time a new LED turns on. 

 


Please explain more thoroughly what you are trying to do. You are updating the LEDs inside the FOR loop, so how is doing anything outside of the FOR loop going to cause something to happen every time that you update an LED? If you could more thoroughly explain what you are trying to do rather how you want to accomplish it then you're likely to get more assistance. I'm guessing that your classmate did a lot more different than put a wait outside of the loop.

 

Edited to add: both loops run just fine on my machine. I'm not sure why you think that the while loop doesn't run.

0 Kudos
Message 3 of 6
(1,534 Views)

Done. 

0 Kudos
Message 4 of 6
(1,529 Views)

I want the RPM indicator to change every time a new led light turns on. Right now it changes every time all 4 led lamps have turned on. 

 

I think that the problem has something to do with the wait timer but I am not 100% sure because when I put the timer outside the for loop the rpm indicator changes in the frequency I want it to change in but the led lights stop functioning. 

0 Kudos
Message 5 of 6
(1,524 Views)
Solution
Accepted by topic author GG00

@GG00 wrote:

/.../when I put the timer outside the for loop the rpm indicator changes in the frequency I want it to change in but the led lights stop functioning. 


The lights still work, but it happens too fast for you to see. 

 

When posting VI's that rely on data in a control, please save the VI with the default values set. What values should go in the "Motor" control?

 

What is this VI supposed to do?

 

A hint is to have only what is really needed in the for loop. In the end you may find that you don't need a for loop.

Certified LabVIEW Architect
0 Kudos
Message 6 of 6
(1,502 Views)