Learning Embedded Linux with Beagleboneblack — Part1
This is a beginner-friendly effort to understand Embedded Linux in a straightforward manner. Previously, I tried learning through device drivers (mostly theoretical), but it proved challenging because there were no hands-on exercises. Now, I’m using a BeagleBone Black, enabling the creation of practical projects while learning each Embedded Linux concept.
Let’s start with a basic program, the classic first project: Blink an LED!
Blink an led
The BBB has four user-controllable LEDs (USR0 through USR3). We can control these directly from the terminal.
steps
- Connect BBB using the USB mini cable to the computer
- Open any SSH terminal (Putty, MobaXterm) and login to BBB (default username: debian, password: temppwd)
- Check virtual directories for LEDs in your BBB
ls /sys/class/leds
4. So we have 4 leds present on our BBB which are represented by usr0, usr1, usr2 and usr3. We can see parameters to control the LEDs inside each of the led directory.ls /sys/class/leds/beaglebone\:green\:usr0
5. We’ll be using brightness parameter to blink the each of the LED individually. Following commands will turn on the LED first by writing 1 to brightness. Second command will turn off the LED.echo 1 > /sys/class/leds/beaglebone\:green\:usr0/brightnessecho 0 > /sys/class/leds/beaglebone\:green\:usr0/brightness
Get We develop’s stories in your inbox
Join Medium for free to get updates from this writer.
6. We can write a script to sequentially turn on all the LEDs
#!/bin/bash
# A simple loop to blink USR3 10 times
for i in {1..10}
do
echo 1 > /sys/class/leds/beaglebone:green:usr0/brightness
echo 1 > /sys/class/leds/beaglebone:green:usr1/brightness
echo 1 > /sys/class/leds/beaglebone:green:usr2/brightness
echo 1 > /sys/class/leds/beaglebone:green:usr3/brightness
sleep 0.5
echo 0 > /sys/class/leds/beaglebone:green:usr0/brightness
echo 0 > /sys/class/leds/beaglebone:green:usr1/brightness
echo 0 > /sys/class/leds/beaglebone:green:usr2/brightness
echo 0 > /sys/class/leds/beaglebone:green:usr3/brightness
sleep 0.5
doneConclusion
Each of the LEDs are controlled by files in the Linux environment. This is the fundamental concept of learning Embedded Linux. Everything is controlled through a set of files! That’s it! We’ll continue this journey in the next part.









