LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

boolean button inside a while loop

Hi,
I have a boolean button inside a while loop, and I was wondering if there is a way to change the value of this boolean from outside of the loop also.
Thank you

0 Kudos
Message 1 of 5
(2,599 Views)
Yes.
 
You can create a local variable of the boolean button and set it to Write.
 
The one catch is that the boolean cannot have a latching action.  So if you need it to pop up after it is read, you will need to simulate that action in your code by setting it back to false right after it is read using another local variable.
0 Kudos
Message 2 of 5
(2,595 Views)
Unless it is set to latch action, you can write the new value to a local variable of it.
 
Can you explain in more detail what you want to do with all this? Often, a better program design will eliminate such tweaks. 🙂
0 Kudos
Message 3 of 5
(2,593 Views)
It worked with the shared variable but is this the best way of doing it :)?

I want to be able to exit my VI wherever my program is currently in. (in the inside loop or the outside loop)
My VI is attached (LV 8.2)
0 Kudos
Message 4 of 5
(2,575 Views)
All you need is a single loop and a state manchine architecture or similar.
 
Don't overcomplicate things, for example the start button could also be used to pause. You could use an event structure as in the attached draft. Modify as needed.
0 Kudos
Message 5 of 5
(2,559 Views)