LabWindows/CVI

取消
显示结果 
搜索替代 
您的意思是: 

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 项奖励
1 条消息(共 4 条)
2,780 次查看

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 项奖励
2 条消息(共 4 条)
2,776 次查看

Yes i do

0 项奖励
3 条消息(共 4 条)
2,768 次查看

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 项奖励
4 条消息(共 4 条)
2,744 次查看