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

#!/bin/bash

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
done
Make sure to run the script as root - e.g. sudo sh led.sh

3 comments:

  1. Great tip, thanks.

    BTW - you can get a root shell in a slightly more straightforward way with "sudo -i". You can also redirect as root with tee(1), something like:

    echo 1 | sudo tee /sys/class/leds/green:ph24:led1/brightness

    ReplyDelete

  2. Thank you, very informative!
    Richard Brown dataroom software

    ReplyDelete
  3. UFC puts out TUF 26 throwing call for three weight classes. The UFC issued a throwing call Wednesday for contenders in three weight classes for the most recent period of the FS1-communicated arrangement: ladies. 'TUF 26' tryouts slated for May 23; male and female UFC hopefuls. UFC on FOX 24's "Jacare" Souza won't down from unsafe battles. RIO DE JANEIRO, Brazil – Ronaldo Souza wasn't shocked when the UFC reacted to his demand for a battle with the name of rising.
    UFC 210
    UFC 210 Live , UFC 210 Fight Card , UFC 210 Fight , UFC 210 Card , UFC 210 Live Stream , UFC 210 PPV



    Two years into UFC title rule, Daniel Cormier as yet battling for regard Meanwhile, after a long keep running as the prevalent belt in the UFC, light ... Daniel Cormier, the current UFC light heavyweight champion, is set to. UFC 210 early say something comes about and live video stream (9 am ET Predictions for each battle on the UFC 210: Cormier versus Johnson 2. UFC 210 Odds And Best Bets For The Biggest Fights And Bonuses.
    UFC 210
    UFC 210 Live , UFC 210 Fight Card , UFC 210 Fight , UFC 210 Card , UFC 210 Live Stream , UFC 210 PPV

    ReplyDelete