-1

I have this easy code, its a traffic light enter image description here Its simple, past 1000ms, it switches to the next case to turn a different light. enter image description here

I build it like this because i heard that you can´t pause or stop a flat sequence either, but im not sure how can i pause this iteration too. Its supposed to be a state machine, im pretty new to labview

I want to put a pause because lets say i want to stop at the amber light until i click the button again or if cant do that, i want the program to stop when i click that button, i dont want to use the while stop, to be more specific, i should use the while stop button. What can i do?

1
  • Please provide enough code so others can better understand or reproduce the problem. Commented Jun 29, 2024 at 12:32

2 Answers 2

0

The easiest way to add a pause button is to connect these 3 booleans as shift registers, then add a case that checks the pause button and prevents the state case from advancing. The correct way would be to have an event handler loop along with a message handler loop (check the queued state machine template) and have a pause state where nothing happens.

Sign up to request clarification or add additional context in comments.

Comments

0

a way to implement the event structure

the way an event structure is implemented is to wait for a event to happen or timeout and behave based on what ended up happening, if you use the event structure in place of your delay it behaves similarly. however, if a -1 is wired it will wait forever and if you use the state machine to determine the time out you can have it alternate between the functions.

when I include an event structure inside a loop I make a frame dedicated to the stop button, benefit being if I click stop it doesn't continue the wait and will end the loop as soon as possible

Each frame of the Event structure can handle multiple Events. In this scenario I have the timeout frame also accept the continue button and in the 'Yellow' case that is the only way to advance to green but in the other cases you could continue through them. A way to get them to not be advanced would be to set the continue button's visibility based on the yellow bool or by a separate Boolean constant

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.