07-15-2009 07:21 AM
HI, I want to create a structure that control my status: for example if it's false = led green, if it's true = led red, if it's true to false = led orange, and if it's false to true = led red.
My structure gets data from arcnet and I need to control the status.
Can anybody help me on that? My structure is attached.
Regards
Felipe
07-15-2009 07:54 AM
If you're going to post code, then please post ALL of it. Your VI calls a couple of VIs that I don't have.
If you truly want to change the color of an LED, you have to use property nodes, and use the COLORS property.
That's not a particularly FAST way to get things done. Property nodes are inherently slower than data movement.
Also, you can't then have them in arrays. The definition of an array is an ordered collection of IDENTICAL elements. Identical means they all have the same properties. That means you can't have element 0 be true = green, and element 1 be true = red. Cannot be done.
You could have an array of a cluster of an LED, but that gets hairy.
If you want to display colors, then display colors. Don't try to bend a boolean LED to fit. Consider using an array of COLOR BOXES.
You can use an array of those, with #0 = red, #1 = orange, #2 = green, whatever, then set it to show only one box, and set the INDEX VALUE property to 0,1,2, 3 to decide what color to show. That works for one indicator.
Or use an array of color boxes, and translate your data into colors (which are U32 values). Use constant color boxes, and decode your data to decide to use this color or that color.
HTH
Blog for (mostly LabVIEW) programmers: Tips And Tricks
07-15-2009 04:58 PM
Thanks for helping me and sorry for not post all of it. I just wanted to get the concept to do my "LED" to change of color.
I didn't understand when you say: " You can use an array of those, with #0 = red, #1 = orange, #2 = green, whatever, then set it to show only one box, and set the INDEX VALUE property to 0,1,2, 3 to decide what color to show. That works for one indicator.", in another words, I couldn't do that. Could you help me to do that?
Regards
Felipe
07-15-2009 05:15 PM - edited 07-15-2009 05:17 PM
I didn't understand when you say: " You can use an array of those, with #0 = red, #1 = orange, #2 = green, whatever, then set it to show only one box, and set the INDEX VALUE property to 0,1,2, 3 to decide what color to show. That works for one indicator."
The attached VI demonstrates this. Run it and adjust the slider and watch the color change.
I don't understand exactly what you need though. Do you need a single 1-D array of such color boxes, or a 2-D array, or a group of 1-D arrays?
Blog for (mostly LabVIEW) programmers: Tips And Tricks
07-15-2009 05:30 PM
What I really need is: I want to create a display that shows me the following: I'm going to test a system and if the system is OK, the LED or Color Box should show me a Green light, if it's not OK should show me Red and if my system was once not OK and now is OK should show me Orange, just to let me know that system was bad but now is OK.
I'd like to use LED but you told me that is not a good idea.
If you could help me to create this structure, I'd be happy.
Regards and THaks again for helping me
Felipe
07-15-2009 05:32 PM
07-15-2009 06:28 PM - edited 07-15-2009 06:29 PM
OK, before you have a chance of clearly identifying a solution, you have to be able to clearly identify the problem.
Consider what you said:
if the system is OK, the LED or Color Box should show me a Green light
but then you said:
if my system was once not OK and now is OK should show me Orange
You have two conflicting statements: If it's OK, show green, and if it's OK, show orange.
That cannot be.
So think deeper. What you're really after is:
If OK
If BAD ONCE
Show Orange
else
Show Green
else
Show Red
end if
That clearly tells you that you need a history, to remember whether the thing was ever bad.
One way to do that is with shift registers.
You want to remember any time you sampled the thing and found a BAD indication.
Change your problem statement to include that:
BAD ONCE = BAD ONCE or not OK
If OK
If BAD ONCE
Show Orange
else
Show Green
else
Show Red
end if
That ought to clearly tell you what needs to be done.
Obviously, you need a way to reset the BAD ONCE memory; that will depend on your situation.
See attached VI.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
07-15-2009 07:57 PM
Simply ---
Create an array of booleans. Build the array from a signle control that has Varable.Properties.Colors[4] set to your desired options.
BUT... what it seems like you want to do is completely different than the four Labview boolean colors so let's dig a bit...
From the help: " for Varable.Properties.Colors[4]" Array of up to 4 (Foreground Color, Background Color) pairs, where Foreground Color is the foreground color of the Boolean control and Background Color is the background color of the Boolean control. Color pairs include; False, True, True to False, and False to True."
Just the conditions you were looking for for your indicator!!!! YEAH but no! so lets dig a bit.
LabVIEW Boolean controls have a mechanical action property. This property changes the value of the control based on events from the front panel. So it is possible for the control to have a value different from the value that was last read from the control. Boolean indicators have no mechanical action property because the value written to them must be known when it is written (data flow corrolary to axiom 1 "thou shalt not pass an indeterminate value.") So, there are no transitional states on indicators.
In order to determine if a transition has occured on a boolean indicator you will need a memory element (such as a shift register) to hold the last known value and the current value. Compare these values and you can set the color.True and Color.False properties of a single boolean indicator to meet your desires. Of course, you can't build them into an array (because array elements have identical properties) but you could use a cluster of booleans to appear similar to an array for the user interface.
07-16-2009 01:53 AM
Thanks Steve Bird,
It was exactly what I was looking for.
Thanks again.
Felipe