LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

State Machine question? How do you turn on and off an LED in a state before moving to the next state? (See details and attached VI).

Solved!
Go to solution

I have a state machine with three states. The goal is to turn the LED on, then off before moving to the next state. In other word, the led is in the level 2 state, I want the LED to keep turning on and off before moving to level 3. Is this possible? How can this be done?

0 Kudos
Message 1 of 3
(227 Views)
Solution
Accepted by topic author GRCK5000

Add two more states, one for led on and one for off.

Message 2 of 3
(201 Views)

@GRCK5000 wrote:

I have a state machine with three states. The goal is to turn the LED on, then off before moving to the next state. In other word, the led is in the level 2 state, I want the LED to keep turning on and off before moving to level 3. Is this possible? How can this be done?


You (indirectly) answered your own question.  If you are in Level 2, where the LED should turn on, then off, then on, then off (almost forever), how would you code it?  You want Level 2 to repeat, but to reverse the value of the Boolean "LED".  Under this condition, what is the next state after Level 2 (in this "forever" mode)?

 

You now have another thing you want to do -- get into and out of "Forever Mode".  If "Forever" is true, the next state after Level 2 is Level (fill in the blank here), and if "Forever" is false, the next state after Level 2 is Level (another fill-in-the-blank).

 

[Please forgive me for not giving you a nice VI that simply does this -- you'll only learn to ask others to do your thinking for you.  But if you stop and ask questions about the task you set for yourself, as I've tried to do, above, an answer (maybe not the answer, whatever that means) should become obvious.

 

Bob Schor

0 Kudos
Message 3 of 3
(173 Views)