问题
I got a Pi2 and wanted to run the led example. But for some reason, the GPIO.setup(11, GPIO.OUT)
always returns without any warnings or errors.
I run it in interactive mode with sudo
, that's how I figured out it returned at the setup()
function.
Can anybody help? Thanks in advance.
Here is the commands I run.
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD) ## neither BOARD nor BCM works.
GPIO.setup(11, GPIO.OUT) ##<<<< it returns here without error.
GPIO.output(11, GPIO.HIGH)
GPIO.cleanup()
回答1:
Ok, installing the beta version of RPi.GPIO fixed the problem.
sudo pip uninstall RPi.GPIO
sudo pip install hg+http://hg.code.sf.net/p/raspberry-gpio-python/code#egg=RPi.GPIO
More info: https://www.raspberrypi.org/forums/viewtopic.php?f=32&t=113014&p=773725
来源:https://stackoverflow.com/questions/33543893/raspberry-pi-2-gpio-setup-exits-without-any-error