Showing posts with label led. Show all posts
Showing posts with label led. Show all posts

Friday, 15 August 2014

Banana Pi: Onboard, User-Definable Green Led

As you may have noticed the BPi has a green LED, which starts blinking as soon as the Pi is powered on: i.e. as soon as something happens with the SD card. It is possible to program the behavior of the LED such as switching it off.

To list the available options open a terminal and enter cat /sys/class/leds/green:ph24:led1/trigger. The default value is heartbeat. If you want to permanently switch it off the trigger needs to be set to none.
user@lemaker ~ $ cat /sys/class/leds/green:ph24:led1/trigger  
none battery-charging-or-full battery-charging battery-full battery-charging-blink-full-solid ac-online usb-online mmc0 timer [heartbeat] backlight gpio cpu0 cpu1 default-on  
user@lemaker ~ $ sudo su  
root@lemaker:~# echo none >  /sys/class/leds/green:ph24:led1/trigger
The LED may be manually turned on and off using the brightness file. The minimum is 0 (i.e. off), and the maximum is 255. To switch it on:
root@lemaker:~# echo 1 >  /sys/class/leds/green:ph24:led1/brightness 

Let it blink


echo none >  /sys/class/leds/green:ph24:led1/trigger
while true; do
echo 1 >  /sys/class/leds/green:ph24:led1/brightness
sleep 1
echo 0 >  /sys/class/leds/green:ph24:led1/brightness
sleep 1
Make sure to run the script as root - e.g. sudo sh