LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

case structure: boolean control did not switch from false to true

Solved!
Go to solution

Hi, I'm trying to use the case structure for traffic light stimulation.

the problem with this structure is while it was running, I tried to switch the boolean control from false to true, but nothing happens. It did not jump out from the false case to the true case.

 

I have tried a couple of adjustments, such as:
1. whether it got stuck in the while loop. (tried different terminal condition)
2. whether the boolean control “stop button” has an issue. (tried creat new boolean controls)
 

However, still not working properly. I have no clue what went wrong and how can I fix it?

shay111_0-1662634179465.png

shay111_1-1662634194658.png

 

 

0 Kudos
Message 1 of 4
(2,153 Views)

Your "Emergency" boolean is outside the loop.  It's value gets read only one time: at the beginning of execution.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 2 of 4
(2,137 Views)
Solution
Accepted by topic author shay111

Hi shay111,

 

In your code, the emergency button is not inside any loop, therefore its value will only be read once at the beginning of the execution. When you run the VI, it reads that the Emergency button is False, so it executes the while loop inside the case structure, and it gets stuck there. Once the code inside the while loop is being executed, it no longer reads the button outside of it, so there are no means of stopping that loop, unless you add a stop button that is inside the loop.

 

I have attached an edit of your VI. See how I have placed the while loop-- Everything is inside it. That means that the emergency button will be continuously read; so as soon as its value changes to True, it will stop the entire loop, hence, the VI.

afort_0-1662638532242.png

 

 

Don't hesitate to ask for further clarifications,

 

Fort

Message 3 of 4
(2,122 Views)

thank you legend.

0 Kudos
Message 4 of 4
(2,054 Views)