🛠 Allumer une LED depuis le GPIO 26 broches

Raspberry Pi Model A (2013) — Board Sheet · debutant · Schéma : IMG-model-a-debutant-1-modela-led-gpio.svg — Raspberry Pi Model A vu de dessus avec le connecteur P1 26 broches, une LED et sa résistance 330 Ω câblées entre GPIO17 (broche 11) et la masse

Objectives

Hardware

Complete code

# Vérifier la présence de la puce GPIO
sudo apt-get install -y gpiod
sudo gpiodetect && sudo gpioinfo

# Broche 11 du connecteur P1 = GPIO17 (BCM)
sudo gpioset gpiochip0 17=1     # LED allumée
sleep 2
sudo gpioset --mode=exit gpiochip0 17=0   # LED éteinte

# Clignotement
while true; do
  sudo gpioset --mode=exit --time 500000 gpiochip0 17=1
done

Expected verification

gpiodetect displays gpiochip0 [brcm2835] (54 lines); the LED turns on with 17=1 and off with 17=0. >

Common errors

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials