LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

LED comit

Hi. I use the LabWindows CVI and i want to turn the LED from yellow to red to green 

i use 

SetCtrlAttribute ( panelHandle, PANEL_LED, ATTR_ON_COLOR, VAL_YELLOW );

SetCtrlAttribute ( panelHandle, PANEL_LED, ATTR_ON_COLOR, VAL_RED); 

SetCtrlAttribute ( panelHandle, PANEL_LED, ATTR_ON_COLOR, VAL_GREEN);

but it dosn't work 

0 Kudos
Message 1 of 4
(2,568 Views)

This may sound stupid, but did you turn the LED on since you modify the ON color?

SetCtrlAttribute ( panelHandle, PANEL_LED, ATTR_CTRL_VAL, 1 );

-----------------------
/* Nothing past this point should fail if the code is working as intended */
0 Kudos
Message 2 of 4
(2,564 Views)

Yes i do

0 Kudos
Message 3 of 4
(2,556 Views)

When you say it doesn't work, what is it that you see, exactly? Do you just see the led becoming green without going through the other colors?

 

Keep in mind that, under normal circumstances, CVI panels don't redraw themselves immediately, when you change a control attribute. They only redraw themselves the next time the user interface and has a chance to process system events -- this would likely happen when your callback function exits, or when you call ProcessSystemEvents, ProcessDrawEvents or GetUserEvent. So, if you want to see those other colors, you'll have to introduce a ProcessDrawEvents call in between your color changes.

 

Of course, even if you do that, you will only see a brief flash of those other colors. Is that your goal? If not, and if you would rather see those other colors for a longer period of time, you'll have to introduce some delay to the code.

0 Kudos
Message 4 of 4
(2,532 Views)