LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

need help with traffic light system

Hi, i needa build a VI to demostrate a simple traffic light system.
 
From green to amber - 5secs
from amber to red - 1 sec and at the same time sending an output to a countdown  timer which runs for 30 secs before turning to green again.
 
is it possible?
0 Kudos
Message 1 of 6
(4,194 Views)
There is a retired CLD exam that gives an example of a traffic light controller. Rather than doing your homework FOR you, I will let you search the NI web site yourself to find it.Smiley Wink
0 Kudos
Message 2 of 6
(4,175 Views)

im quite a newbie in labview, just started not long ago with little help.

need it for a project demostration, i've search this forum for quite some resources and all are way beyond my comprehension. Smiley Sad

hope i get get some pointers here.

i've tried with case structure but it says missing tunnel or something like that.

 

0 Kudos
Message 3 of 6
(4,141 Views)
You could do this with a simple state machine structure.  Have states for "green", "amber", and "red".  Have a case structure inside a while loop with a shift register.  Each case in the structure should pass a value into the shift register to choose the next state (such as the "green" state passing a value to choose "amber"), which is in turn wired to the selector terminal of the case structure.
 
I think the trouble you're having with the case structure might involve unwired output tunnels.  If you place all the indicators inside a cluster, in each state you can pass a single cluster out containing values for each of the indicators.  This will keep you out of trouble as far as the output terminals are concerned.
 
Hope I helped a lil', and good luck!
-Cory
0 Kudos
Message 4 of 6
(4,128 Views)
I like this little exercise. There are so many different ways to accomplish this simple task, and it uses so many of the basic functions necessary for programming. (Structures, arrays, clusters, conditions, user interface, etc.)

One quick and dirty way to change lights in sequence is to use a Sequence Structure. Another way is using an Event Structure, or as corys said, using a state machine. I like to do simple programs like this every once in a while, especially when trying some new feature in LabVIEW

B-).


0 Kudos
Message 5 of 6
(4,107 Views)

Take a look at the example in Developer Zone:

http://zone.ni.com/devzone/cda/epd/p/id/1665

0 Kudos
Message 6 of 6
(4,085 Views)