Basic example to use C for LED control on BBB
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
443 B

4 months ago
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include<string.h>
  4. #define LED3P "/sys/class/leds/beaglebone:green:usr3"
  5. int main() {
  6. FILE* fp;
  7. char fullFile[100];
  8. //trigger non
  9. sprintf(fullFile, LED3P "%s", "/trigger");
  10. fp = fopen(fullFile, "w+");
  11. fprintf(fp, "%s", "none");
  12. fclose(fp);
  13. // Led on
  14. sprintf(fullFile, LED3P "%s", "/brightness");
  15. fp = fopen(fullFile, "w+");
  16. fprintf(fp, "%s", "1");
  17. fclose(fp);
  18. printf("Done\n");
  19. return 0;
  20. }