LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

When the For loop is still runung, how to repeat the measurement inside the For loop?

Hey 

I really need help on this, here is my problem,

I use a for loop to detect the light intensity from different angle.(ex: from -60' to 60'  and 5' is step)

The data from light detector shows 0  sometimes, I think it is the instrument problem.

So I wanna do the measurment in the same angle again when the data shows 0.

Is there any possible when the data is 0, the for loop can make the measurement in the same angle again(without stopping the program)!

Thank you! 

 

 

0 Kudos
Message 1 of 5
(2,658 Views)

Hey Gordan,

 

 

Instead of for loop, use While Loop and make the loop to run for the actual number of times and also check for the data 0. If the data is 0, continue the loop else exit the loop

 

 

Regards,

 

Raja 

0 Kudos
Message 2 of 5
(2,656 Views)

Sounds like a job for a state machine to me. There are examples of state machines in the example finder.

 

You would want a state for reading the value from the device. I assume the device moves so you would want a state for moving it. If you read 0 in your measure state then don't change the state to move, but redo the measurement.

_____________________________
- Cheers, Ed
Message 3 of 5
(2,636 Views)
Well, if was to choose one option. I would go with solution given by Raja ... Easy & Simple Smiley HappySmiley Happy
Thanks & Regards,
Rajan
0 Kudos
Message 4 of 5
(2,633 Views)
There are many things to be said for a state machine. It is scaleable, tidy, an easy concept to understand, and does not take very long to implement or modify.
_____________________________
- Cheers, Ed
Message 5 of 5
(2,621 Views)