gpiotools_blink.sh
No Python needed: gpiotools exports the pin and toggles its level, handy in cron, install scripts or systemd units. GPIO17 is pin 11 of the P1 (26-pin) connector. The trap releases the pin on exit.
Hardware
A Raspberry Pi Model B revision 2 (BCM2835, 26-pin GPIO header, Ethernet/USB ports moved to the board edge). One LED, a 330-ohm resistor, no Python packages (gpiotools only).
Wiring
LED + resistor between GPIO17 (pin 11) and GND, the classic P1 LED build.
How it works
gpio-export creates /sys/class/gpio/gpio17; the script writes 1/0 to value via gpio-set/gpio-clear, direction set at export.
Running it
Copy the script to the board (scp or USB stick), then run it with python3 (or bash). On Raspbian, install gpiozero with sudo apt install python3-gpiozero. The full 26-pin pinout is in the official Raspberry Pi schematic.
Variants
gpio-get reads a button; gpiomon (libgpiod) waits on edges. Revision 2: a clean 5 V supply is required; brown-outs distort sensor readings.
gpiotools_blink.sh
#!/usr/bin/env bash
set -u
# gpiotools_blink.sh — LED clignotante sans Python, via gpiotools.
# Deps: sudo apt install gpiotools
# GPIO17 = broche 11 sur le connecteur 26 broches (P1).
# Alternative sans paquet : echo 17 > /sys/class/gpio/export a la main.
# Relancez si la broche est deja occupee par un autre service.
PIN=17
gpio-export $PIN out
trap 'gpio-unexport $PIN' EXIT
echo "LED sur GPIO$PIN, Ctrl+C pour sortir"
while true; do
gpio-set $PIN
echo "ON"
sleep 0.5
gpio-clear $PIN
echo "off"
sleep 0.5
done