Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5013

Troubleshooting • Re: raspberry pi 5 gpio connection error

$
0
0
"I tried creating (venv) but it didn't work" - here is what I do on a Pi5, then python with gpiozero works in that venv:

Code:

mkdir my_projectcd my_projectpython -m venv --system-site-packages envsource env/bin/activate
e.g. blink an LED on GPIO21

Code:

from gpiozero import LEDfrom time import sleepled = LED(21)try:    while True:        led.on()        sleep(1)        led.off()        sleep(1)except KeyboardInterrupt:    print('Interrupted')

Statistics: Posted by neilgl — Fri Aug 09, 2024 3:53 pm



Viewing all articles
Browse latest Browse all 5013

Trending Articles