O'Reilly logo

Learning BeagleBone by Hunyue Yau

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using the controls in a program

Now that we know how to disconnect the LEDs from the system control and turn them on, let's put it together in a program.

Type the following program and name it ledon.sh:

ledon.sh
1: #!/bin/sh
2: # Replace the names with what is used on your system
3: # Disconnect all 4 LEDs on the BeagleBone so we can use it.
4: echo none > /sys/class/leds/beaglebone:green:usr0/trigger
5: echo none > /sys/class/leds/beaglebone:green:usr1/trigger
6: echo none > /sys/class/leds/beaglebone:green:usr2/trigger
7: echo none > /sys/class/leds/beaglebone:green:usr3/trigger
8: # Turn on all 4 LEDs
9: echo 255 > /sys/class/leds/beaglebone:green:usr0/brightness
10: echo 255 > /sys/class/leds/beaglebone:green:usr1/brightness
11: echo 255 > ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required