Raspberry PI 2 GPIO.setup()退出时没有任何错误

时间:2015-11-05 11:53:48

标签: python gpio raspberry-pi2

我有一个Pi2,想要运行led示例。但由于某种原因,GPIO.setup(11, GPIO.OUT)始终返回而没有任何警告或错误。

我使用sudo以交互模式运行它,这是我在setup()函数中返回的结果。

有人可以帮忙吗?提前致谢。

这是我运行的命令。

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 个答案:

答案 0 :(得分:2)

好的,安装测试版RPi.GPIO解决了这个问题。

sudo pip uninstall RPi.GPIO
sudo pip install hg+http://hg.code.sf.net/p/raspberry-gpio-python/code#egg=RPi.GPIO

更多信息: https://www.raspberrypi.org/forums/viewtopic.php?f=32&t=113014&p=773725