🛠 Faire clignoter une LED via le GPIO avec libgpiod

Orange Pi 3B (Rockchip RK3566) · debutant · Schéma : IMG-orangepi-3b-debutant-1-opi3b-led-gpio.svg — LED et résistance 330 Ω câblées sur une broche GPIO du connecteur 40 broches de l'Orange Pi 3B

Objectives

Discover the 40-pin connector on the Orange Pi 3B (Rockchip RK3566) and blink an LED using libgpiod, the modern Linux API based on character devices — without using the legacy gpio export sysfs mechanism.

Hardware

Full Code

sudo apt install gpiod
gpiodetect                 # gpiochip0 = gpio0 ... gpiochip4 = gpio4 (RK3566)
gpioinfo gpiochip1
# Banques Rockchip exposées par libgpiod : PA=0-31, PB=32-63, PC=64-95, PD=96-127
# Exemple : gpio1_b3 = 32+3 = 35 sur gpiochip1 (vérifier une broche libre sur le plan officiel 40 broches)
sudo gpioset -c gpio1 --time=1 35=1        # niveau haut pendant 1 s
# Clignotage 10 fois
for i in $(seq 1 10); do sudo gpioset -c gpio1 --time=0.2 35=1; sleep 0.3; done
# Récupérer la LED heartbeat système (gpio0_C0 = ligne 64) si elle gêne :
echo none | sudo tee /sys/class/leds/green\:heartbeat/trigger

Expected Verification

gpiodetect displays gpiochip0 through gpiochip4. The LED lights up for approximately 1 second with gpioset --time=1, then blinks 10 times in the loop. The board's green heartbeat LED (gpio0_C0, defined in the mainline device tree) blinks under Linux; this is normal.

Common Errors

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials