- case ACTUATOR_TEST0: //LED actuator test code, should blink onboard LED next to Ethernet port
- FILE *LEDHandle = NULL; //code reference: http://learnbuildshare.wordpress.com/2013/05/19/beaglebone-black-controlling-user-leds-using-c/
- char *LEDBrightness = "/sys/class/leds/beaglebone\:green\:usr0/brightness";
- if(value == 1) {
- if((LEDHandle = fopen(LEDBrightness, "r+")) != NULL) {
- fwrite("1", sizeof(char), 1, LEDHandle);
- fclose(LEDHandle);
+ case ACTUATOR_TEST0:
+ {//LED actuator test code, should blink onboard LED next to Ethernet port
+ FILE *LEDHandle = NULL; //code reference: http://learnbuildshare.wordpress.com/2013/05/19/beaglebone-black-controlling-user-leds-using-c/
+ char *LEDBrightness = "/sys/class/leds/beaglebone:green:usr3/brightness";
+ int val = (!!(int)value);
+ Log(LOGDEBUG, "Val: %d", val);
+ if(val == 1) {
+ if((LEDHandle = fopen(LEDBrightness, "r+")) != NULL) {
+ fwrite("1", sizeof(char), 1, LEDHandle);
+ fclose(LEDHandle);
+ } else perror("fail");
+ }
+ else if(val == 0) {
+ if((LEDHandle = fopen(LEDBrightness, "r+")) != NULL) {
+ fwrite("0", sizeof(char), 1, LEDHandle);
+ fclose(LEDHandle);
+ }