gpio-led-blink-openwrt.sh
Simple Bash script to control an LED via sysfs GPIO on OpenWrt.
Use the 5 or 9-pin headers exposing GPIOs. Connect an LED with a series resistor to the selected GPIO. Run the script via SSH after installing 'bash' if needed. Adjust GPIO_PIN according to the Realtek BSP mapping.
gpio-led-blink-openwrt.sh
#!/bin/sh
# Script de test GPIO pour Banana Pi BPI-RT2 (OpenWrt)
# Vérifiez les numéros de GPIO réels dans /sys/class/gpio/gpiochip*/base
# Exemple : GPIO 10 sur l'en-tête 5 broches
GPIO_PIN=10
# Exporter le GPIO
if [ ! -d /sys/class/gpio/gpio${GPIO_PIN} ]; then
echo ${GPIO_PIN} > /sys/class/gpio/export
fi
# Définir en sortie
echo "out" > /sys/class/gpio/gpio${GPIO_PIN}/direction
# Boucle de clignotement
while true; do
echo 1 > /sys/class/gpio/gpio${GPIO_PIN}/value
sleep 1
echo 0 > /sys/class/gpio/gpio${GPIO_PIN}/value
sleep 1
done