LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

trouble capturing images with multiple while loops

Solved!
Go to solution
I am working on a VI to control a firewire camera. I am currently using a while loop with an event structure inside to control the cameras functions. I also want the camera to be able to start recording images to a folder when a button is pressed and stopped when a stop button is pressed. I wasnt able to get this function into the original while loop but I added another while loop however it doesnt work. I attached an example where the first while loop is simplified (it only contains a displayvideoproperties node) In my actual VI the first while loop has about 10-15 different cases for various functions such as digital subtraction, triggering, etc.. How would I get these parallel while loops to work together or how would I get the second while loop into the first?
0 Kudos
Message 1 of 4
(2,437 Views)
Solution
Accepted by topic author futuramaar

You will need to modify your code.

 

1.  Use a single Event Structure.  The one in the top While Loop will do the trick.  You should have all user events in that same Event Structure (you can have more than 1).

 

2.  Delete the bottom left Event Structure.

 

3.  The bottom While Loop should contain a State Machine.  In this particular situation, I would pass the states from the Event Structure to the State Machine using an ActionEngine (or Functional Global Variable).  That way, your bottom While Loop could continue to loop on the same state and continue to refresh the image contro, capture image, etc.  There are other ways, but this one is probably the simplest.

 

4.  The top Event Strucutre would handle:  control of camera functions, start recording, stop recording, save to file, stop/exit program.

 

R

 

Message 2 of 4
(2,435 Views)

Thanks for the help using the state machine works perfectly.

 

0 Kudos
Message 3 of 4
(2,407 Views)
Glad it worked 🙂
0 Kudos
Message 4 of 4
(2,405 Views)