LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

color change

Hi all,

I try to change the color of three leds.
first is led1 green for 1 second(led2 and led3 are off).
then is led2 yellow for 1sec (led1 and led3 are off).
then is led3 red for 1sec(led1,led2 are off).
then is led1 green....

can me help anybody with this timerroutine?

the problem is not to set the led or the color.

thanks
0 Kudos
Message 1 of 2
(2,993 Views)

I would use a CVI Timer control set to 1 second, with a callback along the following lines:

    static select = 0;    // Static so its value is retained between calls
    static map [3] = {PANEL_LED1, PANEL_LED2, PANEL_LED3};  // Control IDs of LEDs

    SetCtrlVal (panel, map [select], 0);  // Turn off (old) LED
    if (++select == 3)    // Counting ticks
        select = 0;       // Wrap back to 0
    SetCtrlVal (panel, map [select], 1);  // Turn on (new) LED

JR

0 Kudos
Message 2 of 2
(2,988 Views)