🛠 Faire clignoter une LED via le GPIO

ODROID-N2 / ODROID-N2+ (Hardkernel) · debutant · Schéma : IMG-odroid-n2-debutant-1-odroidn2-led-gpio.svg — LED avec résistance 330 Ω branchée entre la broche PIN_23 (GPIOX_11) du connecteur 40 broches et une broche GND (PIN_25) de l'ODROID-N2.

Objectives

Discover the 40-pin GPIO connector on the ODROID-N2 (Amlogic S922X) by blinking an LED. Under a mainline image (Armbian), the BayLibre device-tree assigns readable PIN_xx names to GPIO lines, avoiding any pin number calculation: you directly control PIN_23 (GPIOX_11) with libgpiod v2.

Hardware

Complete code

#!/usr/bin/env bash
# clignotant.sh — LED sur PIN_23 (GPIOX_11), GND sur PIN_25 — libgpiod v2
set -e

# 1. Vérifier que le chip expose bien les noms lisibles du device-tree
gpioinfo gpiochip0 | grep -E 'PIN_(23|25)'

# 2. Clignoter : cycle 0,5 s
while true; do
    gpioset --quiet gpiochip0 PIN_23=1; sleep 0.5
    gpioset --quiet gpiochip0 PIN_23=0; sleep 0.5
done

Expected verification

gpioinfo gpiochip0 | grep PIN_23 displays the line named PIN_23 (GPIOX_11). After running sudo ./clignotant.sh, the LED blinks at 1 Hz; Ctrl-C stops it. gpioset --quiet gpiochip0 PIN_23=0 should turn off the LED.

Common errors

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials