LED
A light-emitting diode (LED) is a semiconductor device that converts electrical energy into light energy. The Rhino Pi-A1 features 4 onboard tricolor LED indicators (led0 ~ led3), each containing three color channels: red, green, and blue. They can be used for system status indication or user-defined display.
Preparation
- Rhino Pi-A1
- Open-source tool: gpiod
shell
sudo apt update
sudo apt install gpiod libgpiod2 libgpiod-devTesting
Android: LED Control
bash
aidlux@aidlux:~$ sudo gpioinfo /dev/gpiochip0 | grep led
line 27: unnamed "led2_green" output active-high [used]
line 44: unnamed "led2_blue" output active-high [used]
line 46: unnamed "led3_red" output active-high [used]
line 108: unnamed "led2_red" output active-high [used]
line 112: unnamed "led1_blue" output active-high [used]
line 118: unnamed "led0_green" output active-high [used]
line 122: unnamed "led1_green" output active-high [used]
line 135: unnamed "led3_blue" output active-high [used]
# Turn on LED3 red
and -s 'echo 1 > /sys/class/new_leds/led3_red/value'
# Turn off LED3 red
and -s 'echo 0 > /sys/class/new_leds/led3_red/value'
# Note: led3_green is already occupied by the system internally, so the LED on/off cannot be controlled by changing led3_green/valueUbuntu: LED Control
bash
aidlux@aidlux:~$ sudo gpioinfo /dev/gpiochip3 | grep led
line 27: unnamed "led2_green" output active-high [used]
line 44: unnamed "led2_blue" output active-high [used]
line 46: unnamed "led3_red" output active-high [used]
line 108: unnamed "led2_red" output active-high [used]
line 110: unnamed "led0_red" output active-high [used]
line 112: unnamed "led1_blue" output active-high [used]
line 118: unnamed "led0_green" output active-high [used]
line 122: unnamed "led1_green" output active-high [used]
line 135: unnamed "led3_blue" output active-high [used]
line 142: unnamed "led3_green" output active-high [used]
# Execute the following commands to control the LEDs
sudo su
cd /sys/class/gpio_userspace
# Turn on LED3 red
echo 1 > led3_red/value
# Turn off LED3 red
echo 0 > led3_red/value
# Note: led3_green is already occupied by the system internally, so the LED on/off cannot be controlled by changing led3_green/value