no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


sdk:scripts:led [2015/05/05 15:04] (current) – created - external edit 127.0.0.1
Line 1: Line 1:
 +====== SDK Script led.are ======
 +<code c led.are>
 +/* DESC: This script can be used to set a LED
 + * Copyright (C) 2012 NetModule AG, Switzerland
 + */
 +
 +LED = 0; /* use first LED */
 +
 +ret = nb_led_acquire(LED);
 +if (ret == -1) {
 +    printf("unable to acquire led%d, retrying...\n", LED);
 +
 +    nb_led_release(LED);
 +    ret = nb_led_acquire(LED);
 +    if (ret == -1) {
 +        printf("stil unable to acquire led%d, exiting\n", LED);
 +        exit(1);
 +    }
 +}
 +
 +ret = nb_led_set(LED, LED_SOLID | LED_COLOR_RED);
 +if (ret != -1) {
 +    printf("led%d is now set to solid red\n", LED);
 +    sleep(5);
 +}
 +ret = nb_led_set(LED, LED_OFF);
 +if (ret != -1) {
 +    printf("led%d is now set to off\n", LED);
 +    sleep(1);
 +}
 +
 +nb_led_release(LED);
 +printf("led%d has been released\n", LED);
 +
 +exit(0);
 +
 +</code>