Raspberry Pi GPIO

Neil HaddleyJuly 22, 2023

Raspberry Pi GPIO

The Raspberry Pi input and output pins can be controlled from the terminal.

Controlling GPIO 17 (Pin 11) using a remote SSH terminal

Controlling GPIO 17 (Pin 11) using a remote SSH terminal

Hardware setup

Hardware setup

Wiring details

Wiring details

sudo python blinky.py

sudo python blinky.py

Notice that Pin 11 === GPIO 17

Notice that Pin 11 === GPIO 17

blinky.py

TEXT
1import RPi.GPIO as GPIO
2import time
3
4GPIO.setmode(GPIO.BOARD)
5GPIO.setwarnings(False)
6
7ledPin = 11
8
9GPIO.setup(ledPin, GPIO.OUT)
10
11for i in range(5):
12 print("LED turning on.")
13 GPIO.output(ledPin, GPIO.HIGH)
14 time.sleep(0.5)
15 print("LED turning off.")
16 GPIO.output(ledPin, GPIO.LOW)
17 time.sleep(0.5)