Showing results for 
Search instead for 
Did you mean: 

Traffic light control and output via serial



I'm busy with a Labview task which concerns the control of a traffic light on the front panel and via the serial output to/from an selfmade PCB with 3 LED's and a switch.


The idea is to have the LED's on the frontpanel and PCB switch state every x seconds (seconds to be adjustable via the front panel)

The time every LED is burning must be written into an array.

When a button is pressed on the PCB, the 'normal' sequence must be stopped and the amber light must be blinking (blinking time also to be set via a numeric control)


I tried already many options, the latest I attached with this post.


Does anybody have some clues to get the task write? The things I don't get straight are the times to the array, and to get the LED's on the PCB to switch together with the LED's on the frontpanel...


Thanks in advance!




0 Kudos
Message 1 of 5

There are a number of issues with your design, not the least of which is your strange use of serial communication.  You appear to be using the "signaling" lines, RTS, TXD, and DTR as your means of communication, rather than using them (as the protocol intends) to allow you to send 8-bit ASCII text through the Com port (where you might send, for example, "Red", "Orange", "Green", or "Blink").


I take it you are "self-taught" in LabVIEW.  I strongly encourage you to spend time with the LabVIEW Tutorials, including the "Getting Started with LabVIEW" offerings mentioned on the first page of this Forum.  Do the Exercises.  Try to understand the principle of Data Flow (if you do, then you will (almost) always wire the Error Lines in the LabVIEW functions that you use.


Try using a Pencil and Paper (or pen, if you prefer) to write a description of what you want to happen.  See if any "patterns" seem to suggest themselves.  [Hint -- State Machine].


Bob Schor

0 Kudos
Message 2 of 5

Hi Bob,


Thanks for your reply in this matter.


I'm indeed just starting with LabVIEW and watched already quite some tutorials and made the excersises which are in the manual.


This task involves the use of the PCB as in the attachment.

The LED's are the actual 'traffic light', one of the pushbuttons has to be used for switching the state.

I tried for loops, state machines etc. but it seems I'm stucked in a way of thinking myself of which I can't get out...


But I'll look into the state machines and hopefully see the (traffic) light at the end of the tunnel!


Download All
0 Kudos
Message 3 of 5

You described the Board as a serial communication device.  How does it work?  Does pushing a button send a button-dependent Text String to the PC's COM port?  Does writing a value to the COM port turn on one of the LEDs on the PCB?


Were the four red things on the PCB PushButtons?  [I assumed they were].


The reason for all the Questions is to get a better understanding of the Task and the communication method(s) that you need.  For example, do you turn on a light by pressing a LabVIEW Button on the Front Panel, pushing a Red Button on the PCB, or either/both?  Does the Red Button send a command LabVIEW, which needs to turn on a Front Panel Indicator and send a command back to the PCB to turn on an LED?  Note that all are possible, it is just important to clearly have the problem stated and explained.


Bob Schor

0 Kudos
Message 4 of 5

And a schematic of the board would help too.  It looks to me that it actually uses digital lines, not a serial port.  So you might actually want a DIO device instead of the serial port.  And, no, just because the board uses a DB9 connector does not mean it uses a serial port.

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 5