LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can we colour one LED in 4 colours by programmatically, using Property node, Colours [4]?

Say, we have Grey indicate off, Amber indicate processing under test, Red indicates fail and Green indicates Pass.
0 Kudos
Message 1 of 7
(10,673 Views)
You can set the color as shown in the attached file.

To change it, use a control instead of the color-constant.
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 2 of 7
(10,673 Views)
You answered you question in the headline. Use the property node with
colours [4]. You can test it with a LED on front panel, creating
property node with colours [4], create a control (array of cluster) for
the property node with colours [4] and see what happens if you change
the values.

astroboy wrote:
> Say, we have Grey indicate off, Amber indicate processing under test,
> Red indicates fail and Green indicates Pass.
0 Kudos
Message 3 of 7
(10,673 Views)
The 4 color clusters in the array needed for the Colors[4] property are indicating the 4 states of a boolean. The first color in the cluster is the foreground color, teh second color is the background color.

The 4 states are False, True, the True to False transition, and the False to True transition. The attached image shows these 4 states.

The easiest way to set the colors is to write to the node using a color box constant. You can find this on the functions palette under Functions>Numeric>Additional Numeric Constants and it's the first one in the first row.

So if you want to change the False color state, referring to the attached image, you can see that you would need to write to the first cluster element of the first array element. If you w
anted to change the True state, you need to write to the first cluster element of the second array element.

Ed


Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 4 of 7
(10,673 Views)
Hi. Ok I have modified my program. Pls take a look and give your comments.

Thanks

Clement
0 Kudos
Message 5 of 7
(10,673 Views)

Hi astroboy,

 

my 2 cents:

- You're not very interested in efficent programming, don't you? Smiley Wink

- You don't need to index the same element twice to have two inputs for arraybuilding.

- You can use one "IndexArray" with more than one output...

- You can move constant operations out of loops/structures...

(Some people may call this RubeGoldberg-code.)

 

The attachment does the same as your vi, but less complicated.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 7
(10,051 Views)

Hmmm third time this morning- but a better question!

 

the states that the Colors[4] property refer to are

0: True

1: False

2: True to False

3: False to True

 

But hold it!  your vi uses boolean INDICATORS!  the transitional states cannot apply! (thou shall not pass an indeterminate value on a wire!)  the transitional states of booleans only apply to controls because of the latching mechanical action property that allows the display to be in a different state than when the value was last read from the terminal (latching bools don't allow access to the value property from property nodes for this exact reason)

 

So, a booean indicator can have only 2 states, either True or False, so only 2 colors[4] elements will display (Property.Colors[4]{0,1}).

 

You will need a custom control to allow more colors to display on something that looks like a round LED.  I'm passing on a gift from the forum I recieved a while ago.

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 7
(10,040 Views)