Home » Flash the ACT led

Flash the ACT led

by shedboy71

Flash the ACT led from the command line, this tip was sent to me so I gave it a try, you could this in a script. The LED in question is seen below, this may depend on the version of Raspberry PI you have as well.

raspberry pi leds

raspberry pi leds

First lets navigate to the LED folder

[codesyntax lang="bash"]
cd /sys/class/leds/led0
[/codesyntax]

Look what’s in the folder

[codesyntax lang="bash"]
ls
[/codesyntax]

You should see something like this:

[codesyntax lang="bash"]
brightness  device  max_brightness  power  subsystem  trigger  uevent
[/codesyntax]

The brightness file controls if the LED is on or off (1 or 0). Lets see what its currently set as.

[codesyntax lang="bash"]
cat brightness
[/codesyntax]

The command should display 0 which is off

The trigger file decides what controls the LED. Print the contents of the trigger file:

[codesyntax lang="bash"]
cat trigger
[/codesyntax]

You should something like this, mmc0 is currently active so when there is SD card activity the LED lights

[codesyntax lang="bash"]
none [mmc0] timer oneshot heartbeat backlight gpio cpu0 default-on rfkill0 phy0rx phy0tx phy0assoc phy0radio
[/codesyntax]

Change to the root user

[codesyntax lang="bash"]
sudo su
[/codesyntax]

Take control over the LED:

[codesyntax lang="bash"]
echo none > trigger
[/codesyntax]

Turn on the LED by putting a 1 into the brightness file:

[codesyntax lang="bash"]
echo 1 > brightness
[/codesyntax]

Turn off the LED by putting a 0 into the brightness file:

[codesyntax lang="bash"]
echo 0 > brightness
[/codesyntax]

Restore the trigger to the sd card

[codesyntax lang="bash"]
echo mmc0 > /sys/class/leds/led0/trigger
[/codesyntax]

Exit and switch back to the pi user

[codesyntax lang="bash"]

exit

[/codesyntax]

Go home

[codesyntax lang="bash"]
cd ~
[/codesyntax]

You may also like

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More