LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trafficlight

Hello I have realized this trafficlight with the purpose to do some practice with labview.
Could this be considered as a State Machines in the way it is thought? It works 3 times doing Green->Yellow+Red-->Red-->Red+Yellow-->Green and so on.

Can you suggest me other implementations? 

Thank you

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

This is no state machine. This is a static sequence which is repeated several times.

The issues with such approach are:

- How do you terminate prematurely as such that the program can shut down gracefully?

- How flexible is the code if you have to change order of execution?

- How readable will the code be if you add 1, 2, .., 10, ...100 new "cases"?

 

You should use a real state machine. You can find an example in the LV template browser which you open by selecting File >> New.

(NOT New VI!)

 

hope this helps,

Norbert

 

PS: Do not use variables.

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 2 of 4
(2,251 Views)

Here some WhitePapers talking about StateMachine Design and giving some examples (Step by step):

 

http://www.ni.com/white-paper/3024/en/

http://www.ni.com/white-paper/7595/en/

Message 3 of 4
(2,240 Views)

mmm ok i'll read the two files linked down and i'll try again.

 

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