0 votes
by (120 points)
How do I import GPIO to Raspberry Pi?

1 Answer

0 votes
by (1.4k points)
import RPi.GPIO as GPIO. By doing it this way, you can refer to it as just GPIO through the rest of your script. To import the module and check to see if it is successful: try: import RPi.GPIO as GPIO except RuntimeError: print("Error importing RPi.GPIO! This is probably because you need superuser privileges.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Nov 28, 2019 by power (1.5k points)
0 votes
1 answer
0 votes
1 answer
asked Oct 10, 2020 by gpio (120 points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
0 answers
...