09-08-2022 05:57 AM - edited 09-08-2022 05:58 AM
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.
However, still not working properly. I have no clue what went wrong and how can I fix it?
Solved! Go to Solution.
09-08-2022 06:22 AM
Your "Emergency" boolean is outside the loop. It's value gets read only one time: at the beginning of execution.
09-08-2022 07:00 AM - edited 09-08-2022 07:31 AM
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.
Don't hesitate to ask for further clarifications,
Fort
09-09-2022 12:06 AM
thank you legend.