🛠 Allumer une LED via le GPIO 40 broches (libgpiod)

Orange Pi 5 Plus (Rockchip RK3588) · debutant · Schéma : IMG-orangepi-5-plus-debutant-1-opi5p-led-gpio.svg — Orange Pi 5 Plus avec une LED et une résistance 330 Ω branchées entre la broche 7 (GPIO1_D6) et une masse du connecteur 40 broches

Objectives

Turn an LED on and off from the 40-pin GPIO connector of the Orange Pi 5 Plus using libgpiod, the modern Linux GPIO interface (the old sysfs /sys/class/gpio is no longer used). Understand the mapping: physical pin 7 of the connector is GPIO1_D6 (wPi 2), which corresponds to gpiochip1, line 30 (bank 1, group D = 3 → 3×8+6 = 30). All 28 GPIOs on the connector are 3.3 V.

Hardware

Complete code

# 1. Installer les outils libgpiod (gpiodetect, gpioset, gpiomon)
sudo apt update && sudo apt install -y gpiod

# 2. Lister les contrôleurs GPIO : gpiochip0..3 = gpio0..gpio3 (RK3588)
gpiodetect

# 3. Faire clignoter la LED 5 fois (broche 7 = gpiochip1, ligne 30)
sudo gpioset -c gpio1 --repeat 5 --hold-period=200ms --period=400ms 30=1

Expected verification

gpiodetect displays gpiochip0 to gpiochip3. The gpioset command makes the LED blink 5 times (200 ms on, 200 ms off) and then exits. On an official Orange Pi image, wiringOP is preinstalled and the same pin is written as sudo gpio mode 2 out then sudo gpio write 2 1 / 0; sudo blink_all_gpio tests the 28 GPIOs on the connector.

Common errors

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials