Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


Sidebar

products:sbc:common:applications:gpio:led

This is an old revision of the document!


LED

Introduction

Onboard LED indicators usage under Linux . You will learn how to control the LEDs.

LED Information

I2C PIN & GPIO(#number) DT Overlays Node Bus Number Device Node
VIM1/2 I2C A SCL(22) - GPIODV_25 (#474)
SDA (23) - GPIODV_24 (#473)
i2c0 0 /dev/i2c-0
I2C B SCL(25) - GPIODV_27 (#476)
SDA(26) - GPIODV_26 (#475)
- 1 /dev/i2c-1
VIM3/3L I2CM 3 SCL(22) - GPIOA_15 (#475)
SDA(23) - GPIOA_14 (#474)
i2c3 3 /dev/i2c-3
I2C AO SCL(25) - GPIOAO_2 (#498)
SDA(26) - GPIOAO_3 (#499)
- 4 /dev/i2c-4
VIM4 I2CM F SCL(22) - GPIOY_17 (#501)
SDA (23) - GPIOY_18 (#502)
i2cm_f 5 /dev/i2c-5
I2CM A SCL(25) - GPIOT_20 (#466)
SDA(26) - GPIOT_21 (#467)
i2cm_a 0 /dev/i2c-0

VIM1/2

VIM1/VIM2 has only one node.

$ ls /sys/class/leds
sys_led

VIM3/3L

VIM3/VIM3L has two nodes.

$ ls /sys/class/leds
red_led  sys_led

VIM4

VIM4 has only one node which is a PWM LED.

$ ls /sys/class/leds
pwmled

Edge1

Edge1 has two nodes.

$ ls /sys/class/leds
read_led  sys_led

Edge2

Setup LED

VIM1/2/3/3L

We will take sys_led (white) as an example.

Turn off

Set the LED node parameter to none to turn off the LED:

$ echo none | sudo tee /sys/class/leds/sys_led/trigger

Turn on

Set the LED node parameter to default-on to keep the LED permanently on:

$ echo default-on | sudo tee /sys/class/leds/sys_led/trigger

Set LED heartbeat

Set the LED node parameter to heartbeat, to make the LED flash with a heartbeat blink:

$ echo heartbeat > /sys/class/leds/sys_led/trigger

You can also try other parameters.

VIM4

We will take pwmled (white) as an example.

Turn off

Set the LED node parameter to none to turn off the LED:

$ echo none | sudo tee /sys/class/leds/pwmled/trigger

Turn on

Set the LED node parameter to default-on, to make the LED permanently on:

$ echo default-on | sudo tee /sys/class/leds/pwmled/trigger

Set LED heartbeat

Set the LED node parameter to heartbeat, to make the LED flash with a heartbeat blink:

$ echo heartbeat > /sys/class/leds/pwmled/trigger

You can also experiment with other parameters.

Edge1

We will use sys_led as an example:

Turn off

Set the LED node parameter to none to turn off the LED:

$ echo none | sudo tee /sys/class/leds/sys_led/trigger

Turn on

Set the LED node parameter to default-on to keep the LED permanently on:

$ echo default-on | sudo tee /sys/class/leds/sys_led/trigger

Set LED heartbeat

Set the LED node parameter to heartbeat, to make the LED flash with a heartbeat blink:

$ echo heartbeat > /sys/class/leds/sys_led/trigger

You can also experiment with other parameters.

Edge2

Last modified: 2022/07/12 23:47 by nick