Blinking BeagleBoard-XM LED (C version)

#include

void main() {

FILE *fp;

//Configures LED to be manually controlled
fp = fopen(“/sys/class/leds/beagleboard\:\:usr0/trigger”, “w”); fprintf(fp, “none”);
fclose(fp);

while (1) {
fp = fopen(“/sys/class/leds/beagleboard\:\:usr0/brightness”, “w”); fprintf(fp, “1”);
fclose(fp);
sleep(1);

fp = fopen(“/sys/class/leds/beagleboard\:\:usr0/brightness”, “w”); fprintf(fp, “0”);
fclose(fp);
sleep(1);
}

}

9 thoughts on “Blinking BeagleBoard-XM LED (C version)

    1. Rafael Aroca Post author

      Simply include stdio.h, after all the above program only uses standard file operations.

      Reply
  1. danymansk8

    Hola! I just got a Beagleboard XM, but it is too old there is no more documentation for it. I need to know how to download the code and start working on it. Could you give me a little hand?

    Thanks in advance!

    Reply
    1. Rafael Aroca Post author

      Hi. Did you install Linux? Can you SSH or have a terminal in the board? Almost anything you can do or learn with a Raspberry, you can do with this Board, with the exception of hardware I/O, that is different, but you can still use sysfs to access GPIO, as in RPI…

      Reply
      1. danymansk8

        Thanks for the answer. Unfortunately, I am extremely new at this and I’m having troubles understanding it.

        I have Linux installed in the Board. Which are the next steps? I mean, where should I start coding, where is the code compiled, and how to download it to the board? An example would be the best, but so far haven’t seen any.

        Is there any step by step documentation on how to do it? I’m feeling very lost on this.

        Thanks again for the help.

        Dany

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s