2.9.1. Blinking an LEDΒΆ

LEDs can be accessed and controlled by the user through sysfs LED interface. For example, the AM64x Starter Kit EVM has the following LEDs available in sysfs:

root@am64xx-evm:~# ls /sys/class/leds
amber:activity    green:activity    green:activity_2  mmc0::  red:activity
amber:activity_1  green:activity_1  green:activity_3  mmc1::  red:activity_1

The following commands can be used to turn on/off an LED (using LED red:activity listed above as an example):

echo 1 > /sys/class/leds/red:activity/brightness
echo 0 > /sys/class/leds/red:activity/brightness

Something similar to the following can be put to a shell script to blink an LED, i.e. turn it on/off periodically:

for i in {1..10}
do
    echo 1 > /sys/class/leds/red:activity/brightness
    sleep 0.5
    echo 0 > /sys/class/leds/red:activity/brightness
    sleep 0.5
done

In addition, the following commands can be used to start or stop heartbeat blinking for an LED:

echo heartbeat > /sys/class/leds/red:activity/trigger
echo none > /sys/class/leds/red:activity/trigger