How To Control LEDs

Switch to root user

Only the root user has the authority to control and modify the node status of the LEDs.

1
2
3
khadas@Khadas:~$ su
Password:
root@Khadas:/home/khadas#

Check LED Node

VIM1 has only one node.
1
2
3
root@Khadas:/home/khadas# cd /sys/class/leds/
root@Khadas:/sys/class/leds# ls
sys_led

VIM2 has only one node.

1
2
3
root@Khadas:/home/khadas# cd /sys/class/leds/
root@Khadas:/sys/class/leds# ls
sys_led

VIM3/VIM3L has two nodes.

1
2
3
root@Khadas:/home/khadas# cd /sys/class/leds/
root@Khadas:/sys/class/leds# ls
red_led sys_led

How To Use

Here takes sys_led as an example:

1
2
3
root@Khadas:/sys/class/leds# cd sys_led
root@Khadas:/sys/class/leds/sys_led# ls
brightness device invert max_brightness power subsystem trigger uevent

Check the parameters:

1
2
root@Khadas:/sys/class/leds/sys_led# cat trigger
none rc-feedback kbd-scrolllock kbd-numlock kbd-capslock kbd-kanalock kbd-shiftlock kbd-altgrlock kbd-ctrllock kbd-altlock kbd-shiftllock kbd-shiftrlock kbd-ctrlllock kbd-ctrlrlock timer oneshot [heartbeat] backlight gpio cpu0 cpu1 cpu2 cpu3 cpu4 cpu5 default-on transient panic rc_feedback emmc sd sdio rfkill0 rfkill1 rfkill2 rfkill3
  • Turn off

Set none parameter to turn off the LED:

1
root@Khadas:/sys/class/leds/sys_led# echo none > trigger
  • Turn on

Set default-on parameter to turn off the LED:

1
root@Khadas:/sys/class/leds/sys_led# echo default-on > trigger

Set heartbeat to make the LED heartbeat flash:

1
root@Khadas:/sys/class/leds/sys_led# echo heartbeat > trigger

You can also try other parameters.