🛠 Faire clignoter la LED bleue via le GPIO
Objectives
Discover the GPIO of the ODROID-C4 under the mainline kernel (Armbian current or DietPi) by blinking the embedded blue "status" LED. You will learn to identify the two exposed GPIO controllers (gpio and gpio_ao), understand the role of the heartbeat kernel trigger, and control a line using libgpiod v2 (Debian Bookworm syntax).
Hardware
- ODROID-C4 (2 or 4 GB) with a 12 V/2 A power supply on the 5.5/2.1 mm DC jack (the USB OTG port does not provide enough current)
- microSD card with Armbian "current" (kernel 6.6 mainline)
- HDMI screen or UART serial console 115200 8N1
- No external components: the status LED is soldered onto the board (pin GPIOAO_11, active high)
Complete code
#!/usr/bin/env bash
# blink-status.sh - clignoter la LED bleue (chip gpio_ao, ligne 11)
# 1) Vérifier la présence des deux chips GPIO
gpiodetect
# 2) Rendre la LED à l'espace utilisateur (désactive le trigger heartbeat)
echo none > /sys/class/leds/blue:status/trigger 2>/dev/null || true
# 3) Boucle de clignotement : 250 ms ON, 250 ms OFF
while true; do
gpioset --time=250ms gpio_ao 11=1
gpioset --time=250ms gpio_ao 11=0
done
Expected verification
gpiodetect must list two chips: gpio (GPIOA/GPIOH/GPIOX/BOOT banks) and gpio_ao (always-on bank). After launching the script, the blue LED blinks approximately twice per second. gpioget gpio_ao 11 returns 1 or 0 depending on the moment. Stop with Ctrl+C: the LED remains in its last state.
Common errors
- The LED refuses to obey because the
heartbeattrigger is still active: writenoneto/sys/class/leds/blue:status/triggerbefore controlling the line. - Trying to use wiringPi (
gpio -g) as on Raspberry Pi: not guaranteed on Armbian mainline, prefer libgpiod. - Confusing
gpioandgpio_ao: the status LED is ongpio_aoline 11, not on thegpiochip. - Forgetting sudo: access to GPIO lines requires root or appropriate group membership.
Other tutorials for this board
Code examples for this board
clignotante.pyPythonbouton-gpio.pyPythoncapteur-i2c.shBashsurveillance-temperature.shBashcapteur-dht11.pyPythonservo-pwm-sysfs.shBash