LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

changing colours of LED

Hi I have a Vi for experiment. I am not sure how I can set the colours of LED. Once I understand how it works, then I can incorporate it into the main program.

It went like this: Uponing running it, the 2 LEDs (Red and green) must turn to black or grey in colour to indicate that the machine is awating test or not under test now. After 10 sec, the 2 LEDs are turned to yellow to indicate that it is under test now. Such that the they must alternate in black or grey and yellow each second. I cannot use blinking property for those LEds as I find it hard to make them blink at alternate times. After the red or green toggle switch has been set and the result button is pressed, one of the LEDs must be in red or green based on the toggle switch and
the rest must be in black or grey. I find it hard to understand especially color property
0 Kudos
Message 1 of 9
(3,600 Views)
A description of the input for the color property is in the Context Help
(ctrl+H).

"Array of up to 4 (FG color, BG color) pairs. Color pairs include False,
True, True to False, and False to True."

You've defined the color for false, and erased the definitions for all other
cases. Set the other three pairs and you should see what you expect.
0 Kudos
Message 2 of 9
(3,600 Views)
A led color is an ARRAY of clusters containing the background and the foreground color. Background color is irrelevant for 3D style leds, but if you replace one led with a classic style led, you will see the difference.
You just forgot to define the True-state colors (and T-to-F, F-to-T..., but that's less important), in the second cluster element of the color array (Have you noticed that it was a 4 elements array ?).
Chilly Charly    (aka CC)
0 Kudos
Message 3 of 9
(3,600 Views)
Hmmm....
May be you should have given some attention to Ed Dickens answer on your previous post (10/4/2004)...
Chilly Charly    (aka CC)
0 Kudos
Message 4 of 9
(3,600 Views)
Ok I am not sure if I am doing the right thing. What do you guys think of my program? Pls give your comments.

Thanks for your advice
0 Kudos
Message 5 of 9
(3,600 Views)
You can simplify the second frame a bit by observing that you don't have to
change the color assignments of the LED's during each loop iteration. You
can assign one color to both for false and the another color to both for
true before entering the loop and then just toggle the true/false value once
a second. The color will still alternate as you desire.


"astroboy" wrote in message
news:506500000005000000C6E10100-1079395200000@exchange.ni.com...
> Ok I am not sure if I am doing the right thing. What do you guys think
> of my program? Pls give your comments.
>
> Thanks for your advice
0 Kudos
Message 6 of 9
(3,600 Views)
Hi. Thanks for your advice. One thing I dun understand is that in my previous example, the green Led turns green between amber and grey during toggle period for a brief period. After your advice, it looks different. Now the green LED only toggles amber and grey without slighest green. Is that becos of the case structure to turn LEDs? Pls see my improved example.
0 Kudos
Message 7 of 9
(3,600 Views)
Hi. Thanks for your advice. One thing I dun understand is that in my previous example, the green Led turns green between amber and grey during toggle period for a brief period. After your advice, it looks different. Now the green LED only toggles amber and grey without slighest green. Is that becos of the case structure to turn LEDs? Pls see my improved example.
0 Kudos
Message 8 of 9
(3,600 Views)
The reason you don't see the green is because you are no longer toggling
between the true and false states. Green must have been the true to false
or false to true color. Remember that the color for each LED is an array of
four FG/BG pairs to indicate the two states and the two transitions of the
LED.

Interestingly, your implementation isn't what I expected but it does work
well. My advice was to set the colors only once during the amber/grey phase
and toggle the true/false value every second. This should be more efficient
than changing the colors every iteration. But to avoid the dash of green
you noticed before, all four color pairs should be set instead of just the
false and true color pairs.


"astroboy" wrote in message

news:5065000000050000006FE20100-1079395200000@exchange.ni.com...
> Hi. Thanks for your advice. One thing I dun understand is that in my
> previous example, the green Led turns green between amber and grey
> during toggle period for a brief period. After your advice, it looks
> different. Now the green LED only toggles amber and grey without
> slighest green. Is that becos of the case structure to turn LEDs? Pls
> see my improved example.
0 Kudos
Message 9 of 9
(3,600 Views)