LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to toggle the colors of a button (3 colors)?

Hi,
I need to simulate a traffic light, so I was wondering what approach I should take to have the same button be able to switch 3 different states (red/yellow/green)? I really have no idea how to approach this, what controls should I use in labview to accomplish this?
0 Kudos
Message 1 of 5
(4,309 Views)
Boolean LED indicators (which give the best appearance) have only 2 standard states (T/F) of which you can have each state be any color. But when you need 3 colors, you have to use property nodes.
If you can keep all your property nodes and the actual booleon LED Indicator (they reference) on the same VI, then its much easier. If you need to get the G/Y/R info from a subvi, you have to use RefNums to pass properties (vs. just property nodes).

I'm attaching a neat VI which I use for a few applications needing 3-colored LEDs. Basically, I convert 3 mutually exclusive boolean inputs into a boolean number (000 to 111) and let the numbers (1 or 2 or 4) feed a case of the 3 numbers. Each case has the property node of the LED with a chosen color.
If you need ve
rsion 5, let me know.

Good Luck with it, Doug
0 Kudos
Message 2 of 5
(4,309 Views)
Here is a simple VI that simulates a traffic light. One button toggles the setting from red to green and back to red via yellow. It uses a shift register to keep track of the color of the light and a 0,1,2,0,1,2... counter is implemented to cycle thru the different settings. The traffic light indicator is a cluster of three LEDs with different colors. Hope this helps. /Mikael
0 Kudos
Message 3 of 5
(4,309 Views)
> I need to simulate a traffic light, so I was wondering what approach
> I should take to have the same button be able to switch 3 different
> states (red/yellow/green)? I really have no idea how to approach this,
> what controls should I use in labview to accomplish this?

If you have pictures of the traffic light, then you should look to use
a picture ring. This lets you import graphics for the different states.
You can then hide some of the borders and such using the transparent
color.

Another way of doing this is to make three Booleans, say in a cluster.
Write to the cluster with only one of the Booleans on. You can still
import a graphic behind the Booleans and make the cluster transparent.

Greg McKaskle
0 Kudos
Message 4 of 5
(4,309 Views)
If you only want's to change the color of the buttons, you can use the color
entry of the property node. I always use that in my actual program to
display working, scheduling and error states.

greets
Henrik


Helper schrieb in im Newsbeitrag:
506500000008000000AD250000-993342863000@exchange.ni.com...
> Hi,
> I need to simulate a traffic light, so I was wondering what approach
> I should take to have the same button be able to switch 3 different
> states (red/yellow/green)? I really have no idea how to approach this,
> what controls should I use in labview to accomplish this?
0 Kudos
Message 5 of 5
(4,309 Views)