RPi.GPIO library using error.
voxventi
New Member Posts: 5 ✭
When I try RPi.GPIO example from wiki And code here;
import RPi.GPIO as GPIO
import time
# Pin Definitons:
ledPin = 4
# Pin Setup:
GPIO.setmode(GPIO.BCM)
GPIO.setup(ledPin, GPIO.OUT) # LED pin set as output
print("Here we go! Press CTRL+C to exit")
try:
while 1:
GPIO.output(ledPin, GPIO.HIGH)
time.sleep(0.5)
GPIO.output(ledPin, GPIO.LOW)
time.sleep(0.5)
except KeyboardInterrupt: # If CTRL+C is pressed, exit cleanly:
GPIO.cleanup() # cleanup all GPIO
And I run this command on terminal:
python3 ledblink.py
I get this error message;
Traceback (most recent call last):
File "ledblink.py", line 1, in <module>
import RPi.GPIO as GPIO
File "/home/rnd/.local/lib/python3.8/site-packages/RPi/GPIO/__init__.py", line 23, in <module>
from RPi._GPIO import *
RuntimeError: This module can only be run on a Raspberry Pi!
How can i fix that?
Edit1: According to wiki UPBoard supports RPi.GPIO library