Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


products:sbc:common:applications:gpio:led

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
products:sbc:common:applications:gpio:led [2022/07/12 23:47]
nick
products:sbc:common:applications:gpio:led [2026/05/11 02:23] (current)
nick
Line 4: Line 4:
 ===== Introduction ===== ===== Introduction =====
 /* /*
-This document mainly describes the onboard LEDs. You will learn how to control the LEDs.+This page mainly describes the onboard LEDs and leads you to control the LEDs.
 */ */
-Onboard LED indicators usage under Linux . You will learn how to control the LEDs. +This page introduces the usage of Onboard LED indicators under Linux, and leads you to control the LEDs. 
  
-===== LED Information =====+===== Device LED configurations =====
  
-|           ^  I2C    ^  PIN & GPIO(#number)                                        DT Overlays Node  ^  Bus Number  ^  Device Node  ^ +^  Device      ^  Node name                  ^  LED color  ^ 
-^  VIM1/  | I2C A   |  SCL(22) - GPIODV_25 (#474)\\ SDA (23) - GPIODV_24 (#473)  |  i2c0              |  0           |  /dev/i2c-0   +^  VIM1/     |  /sys/class/leds/sys_led    |  White      | 
- :::      | I2C B    SCL(25) - GPIODV_27 (#476)\\ SDA(26) - GPIODV_26 (#475)    -                  1           |  /dev/i2c-1   + VIM3/3L     |  /sys/class/leds/red_led    |  Red        
-^  VIM3/3L  I2CM 3  |  SCL(22) - GPIOA_15 (#475)\\ SDA(23) - GPIOA_14 (#474)     |  i2c3              |  3           |  /dev/i2c-3   + :::         |  /sys/class/leds/sys_led    |             
- :::      I2C AO   SCL(25) - GPIOAO_2 (#498)\\ SDA(26) - GPIOAO_3 (#499)     |  -                 |  4           |  /dev/i2c-4   | +^  VIM1S/VIM4  |  /sys/class/leds/pwmled     |             | 
- VIM4     I2CM F  |  SCL(22) - GPIOY_17 (#501)\\ SDA (23) - GPIOY_18 (#502)    |  i2cm_f            |  5           |  /dev/i2c-5   + Edge1       |  /sys/class/leds/red_led    |             
- :::      | I2CM A  |  SCL(25) - GPIOT_20 (#466)\\ SDA(26) - GPIOT_21 (#467)      i2cm_a            |  0           |  /dev/i2c-0   |+ :::         |  /sys/class/leds/sys_led                | 
 + Edge2/Edge-2L   /sys/class/leds/red_led    |  Red        | 
 +|  :::         |  /sys/class/leds/green_led  |  Green      
 + :::         |  /sys/class/leds/blue_led   |  Blue       |
  
  
 +===== Setup LED =====
  
-<tabbox VIM1/2>+<tabbox VIM1/2/3/3L>
  
-VIM1/VIM2 has only one node.+We will take ''sys_led'' (white) as an example.
  
-```shell +**Turn off**
-$ ls /sys/class/leds +
-sys_led +
-```+
  
-<tabbox VIM3/3L> +Set the LED node parameter to ''none'' to turn off the LED:
- +
-VIM3/VIM3L has two nodes.+
  
 ```shell ```shell
-ls /sys/class/leds +echo none | sudo tee /sys/class/leds/sys_led/trigger
-red_led  sys_led+
 ``` ```
  
-<tabbox VIM4>+**Turn on**
  
-VIM4 has only one node which is a PWM LED.+Set the LED node parameter to ''default-on'' to keep the LED permanently on:
  
 ```shell ```shell
-ls /sys/class/leds +echo default-on | sudo tee /sys/class/leds/sys_led/trigger
-pwmled+
 ``` ```
  
-<tabbox Edge1>+**Set LED heartbeat**
  
-Edge1 has two nodes.+Set the LED node parameter to ''heartbeat'', to make the LED flash with a heartbeat blink:
  
 ```shell ```shell
-ls /sys/class/leds +echo heartbeat | sudo tee /sys/class/leds/sys_led/trigger
-read_led  sys_led+
 ``` ```
-<tabbox Edge2> 
  
-</tabbox>+You can also experiment with other parameters.
  
-===== Setup LED =====+<tabbox VIM1S/VIM4>
  
-<tabbox VIM1/2/3/3L> +We will take ''pwmled'' (white) as an example.
- +
-We will take ''sys_led'' (white) as an example.+
  
 **Turn off** **Turn off**
Line 70: Line 63:
  
 ```shell ```shell
-$ echo none | sudo tee /sys/class/leds/sys_led/trigger+$ echo none | sudo tee /sys/class/leds/pwmled/trigger
 ``` ```
  
 **Turn on** **Turn on**
  
-Set the LED node parameter to ''default-on'' to keep the LED permanently on:+Set the LED node parameter to ''default-on''to make the LED permanently on:
  
 ```shell ```shell
-$ echo default-on | sudo tee /sys/class/leds/sys_led/trigger+$ echo default-on | sudo tee /sys/class/leds/pwmled/trigger
 ``` ```
 +
  
 **Set LED heartbeat** **Set LED heartbeat**
Line 86: Line 80:
  
 ```shell ```shell
-$ echo heartbeat /sys/class/leds/sys_led/trigger+$ echo heartbeat | sudo tee /sys/class/leds/pwmled/trigger
 ``` ```
  
-You can also try other parameters.+You can also experiment with other parameters.
  
-<tabbox VIM4>+<tabbox Edge1>
  
-We will take ''pwmled'' (white) as an example.+We will use ''sys_led'' as an example:
  
 **Turn off** **Turn off**
Line 100: Line 94:
  
 ```shell ```shell
-$ echo none | sudo tee /sys/class/leds/pwmled/trigger+$ echo none | sudo tee /sys/class/leds/sys_led/trigger
 ``` ```
  
 **Turn on** **Turn on**
  
-Set the LED node parameter to ''default-on''to make the LED permanently on:+Set the LED node parameter to ''default-on'' to keep the LED permanently on:
  
 ```shell ```shell
-$ echo default-on | sudo tee /sys/class/leds/pwmled/trigger+$ echo default-on | sudo tee /sys/class/leds/sys_led/trigger
 ``` ```
- 
- 
 **Set LED heartbeat** **Set LED heartbeat**
  
Line 117: Line 109:
  
 ```shell ```shell
-$ echo heartbeat /sys/class/leds/pwmled/trigger+$ echo heartbeat | sudo tee /sys/class/leds/sys_led/trigger
 ``` ```
  
 You can also experiment with other parameters. You can also experiment with other parameters.
  
-<tabbox Edge1> +<tabbox Edge2/Edge-2L
- +We will use ''red_led'' as an example:
-We will use sys_led as an example:+
  
 **Turn off** **Turn off**
Line 131: Line 122:
  
 ```shell ```shell
-$ echo none | sudo tee /sys/class/leds/sys_led/trigger+$ echo none | sudo tee /sys/class/leds/red_led/trigger
 ``` ```
  
Line 139: Line 130:
  
 ```shell ```shell
-$ echo default-on | sudo tee /sys/class/leds/sys_led/trigger+$ echo default-on | sudo tee /sys/class/leds/red_led/trigger
 ``` ```
 **Set LED heartbeat** **Set LED heartbeat**
Line 146: Line 137:
  
 ```shell ```shell
-$ echo heartbeat /sys/class/leds/sys_led/trigger+$ echo heartbeat | sudo tee /sys/class/leds/red_led/trigger
 ``` ```
 +The others are similar. 
 + 
 You can also experiment with other parameters. You can also experiment with other parameters.
- 
-<tabbox Edge2> 
  
 </tabbox> </tabbox>
Last modified: 2022/07/12 23:47 by nick