Skip to content
UPEEC

gpiozero, RPi.GPIO, pigpio and lgpio

Raspberry Pi GPIO libraries; gpiozero is the friendliest.

Easy
Comments 0
from gpiozero import LED, Button
from signal import pause
led, btn = LED(17), Button(2)
btn.when_pressed = led.toggle
pause()

On Raspberry Pi 5, use gpiozero or lgpio — RPi.GPIO doesn't support it.

Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.

Discussion (0)

Sign in or join free to ask questions and discuss this topic.