Reader small image

You're reading from  Learning BeagleBone

Product typeBook
Published inDec 2014
Publisher
ISBN-139781783982905
Edition1st Edition
Right arrow
Author (1)
Hunyue Yau
Hunyue Yau
author image
Hunyue Yau

Hunyue Yau is an electrical engineer who graduated from the California Institute of Technology. He has worked with Linux since the early '90s, starting with the Soft Landing System. He created one of the first embedded Linux devices in 1996 with a custom-made distribution. He has worked on various products such as embedded Linux appliances, embedded BSD-based devices, and embedded Linux mobile devices. As an active member of the BeagleBoard community, he has volunteered at numerous community events, from Maker Faire to Google Summer of Code mentoring. Today, Hunyue synergizes his electrical engineering skills with embedded Linux software skills to provide turnkey embedded Linux consulting services through HY Research LLC (http://www.hy-research.com/), a company founded by him.
Read more about Hunyue Yau

Right arrow

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 > /sys/class/leds/beaglebone:green:usr2/brightness
12: echo 255 > /sys/class/leds/beaglebone:green:usr3/brightness

Let's analyze the preceding program:

  • The first line tells the Linux kernel that this is a shell script.

  • From lines...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Learning BeagleBone
Published in: Dec 2014Publisher: ISBN-13: 9781783982905

Author (1)

author image
Hunyue Yau

Hunyue Yau is an electrical engineer who graduated from the California Institute of Technology. He has worked with Linux since the early '90s, starting with the Soft Landing System. He created one of the first embedded Linux devices in 1996 with a custom-made distribution. He has worked on various products such as embedded Linux appliances, embedded BSD-based devices, and embedded Linux mobile devices. As an active member of the BeagleBoard community, he has volunteered at numerous community events, from Maker Faire to Google Summer of Code mentoring. Today, Hunyue synergizes his electrical engineering skills with embedded Linux software skills to provide turnkey embedded Linux consulting services through HY Research LLC (http://www.hy-research.com/), a company founded by him.
Read more about Hunyue Yau