Jump to content

Assigning functions to LEDs on Orange Pi Zero.


Aditya

Recommended Posts

Hi !

I am running deb stretch server on OPi Zero LTS. To control LEDs I tried to follow this thread https://forum.armbian.com/topic/6306-orange-pi-zero-h2-status-led/

So if I edit the file /sys/class/leds/orangepi:green:pwr/trigger to select "cpu" but I get the following

 

opi@orangepizero:/$ sudo echo "power" > /sys/class/leds/orangepi:green:pwr/trigger
-bash: /sys/class/leds/orangepi:green:pwr/trigger: Permission denied

With root as user, this is what I get

root@orangepizero:/# echo "power" > /sys/class/leds/orangepi:green:pwr/trigger
bash: echo: write error: Invalid argument

however, if I edit the file using nano and delete all contents and then type cpu then it gets saved and green led shows intended status.

Whats the standard procedure to do this??

Link to comment
Share on other sites

1 hour ago, Aditya said:

Whats the standard procedure to do this??

When using "sudo", it only affect the left part, here "echo", everything at right of ">" isn't "sudo" applied ...

So, if you wish to use "sudo", syntax would be :

echo "default-on" | sudo tee /sys/class/leds/orangepi:green:pwr/trigger

Note here : "power" is not an available choice, do "cat /sys/class/leds/orangepi:green:pwr/trigger", it will show you all possible choices and the current setting is indicated with brackets. The choice you probably wish is "default-on".

 

Link to comment
Share on other sites

Thanks a lot. It works fine. :)

It asked for a password when I entered the command like you just told, so how to use this command in rc.local or how to execute it at boot??

Edit:

Simply added the line to /etc/rc.local

Thanks again btw

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines