t2:led_vmget

led_vmget


led_vmget — Get current count value

Description


int16 led_vmget(<LED_IDENTIFIER>);

Check how many duty cycle periods remains to be executed for the LED identified by <LED_IDENTIFIER>.

Parameters


  • <LED_IDENTIFIER>: An valid LED identifier LED_1, LED_2, LED_3 or LED_4. Note: the LED identifier is passed as direct parameter of the led_vmget() opcode, therefore stack values can't be used.

Return Value


Returns the current count value. The count value is initially set by led_vmset() and decremented by one for each executed duty cycle period.

A negative returning value indicates the duty period is configured to repeat indefinitely.

Examples


Example #1 led_vmget() example

int state = 0;
 
main {
    switch(state) {
        case 0: {
            if(led_vmget(LED_2) == 0) {
                led_vmset(LED_3, 200, 500, 3);
                state = 1;
            }
        } break;
        case 1: {
            if(led_vmget(LED_3) == 0) {
                led_vmset(LED_2, 500, 200, 2);
                state = 0;
            }
        } break;
    }
}

See Also

t2/led_vmget.txt · Last modified: 2016/11/29 09:10 by J2Kbr