From 11:00 PM CST Friday, Feb 14th - 6:30 PM CST Saturday, Feb 15th, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From 11:00 PM CST Friday, Feb 14th - 6:30 PM CST Saturday, Feb 15th, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
09-24-2012 12:14 PM
How to set LED indicator to three colors? Dark green (default), Green (Off) and RED (ON).
No callback used, only postUI message to set the led to on or off state.
Thanks.
Solved! Go to Solution.
09-24-2012 01:00 PM - edited 09-24-2012 01:21 PM
Hi,
you almost gave the answer yourself : I see two possibilities:
1) Use SetCtrlAttribute (, , ATTR_DFLT_VALUE, ); SetCtrlAttribute (, , ATTR_OFF_COLOR, ); or SetCtrlAttribute (, , ATTR_ON_COLOR, );
2) Since you are using the LED as indicator I see no functional difference between ON and OFF, so you could define your own function SetLEDState ( 0 / 1 / 2 ) where you simply change the ON color depending on your state, something like
int SetLEDState ( int panel, int control, int state )
{
switch ( state )
{
case 0:
color = VAL_DK_GREEN;
break;
case 1:
color = VAL_GREEN;
break;
case 2:
color = VAL_RED;
break;
}
SetCtrlAttribute ( panel, control, ATTR_ON_COLOR, color );
}
09-24-2012 03:03 PM
Another alternative is to use a picture ring loaded with three LED images with the proper colors and associated values: the desired color can then be obtained with a simple SetCtrlVal (panelHandle, PANEL_LED, color); call