Home Documentation Tutorials API GitHub

LED

The Led API manages LED state using /sys/class/leds.

See the Linux documentation for details on how this sysfs works.

On/Off

Toggle LEDs on and off with the on, off, and set methods:

Led.on("beaglebone:green:usr0")
Led.off("beaglebone:green:usr0")
Led.set("beaglebone:green:usr0", true)

Blinking

Configure a LED to blink using the blink methods, where the arguments specify how long to leave the LED on and off:

// on for 1sec; off for 500ms
Led.blink("beaglebone:green:usr1", 1sec, 500ms)

Triggers

A trigger is a kernel based source of LED events. Examples for the bb are heartbeat, mmc0, cpu0. Consult your platform for available triggers and see the Linux documentation for low level details.

Led.trigger("beaglebone:green:usr2", "heartbeat")