简体   繁体   English

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

[英]Raspberry PI 2 GPIO.setup() exits without any error

I got a Pi2 and wanted to run the led example. 我得到了Pi2,并希望运行带头的示例。 But for some reason, the GPIO.setup(11, GPIO.OUT) always returns without any warnings or errors. 但是由于某些原因, GPIO.setup(11, GPIO.OUT)始终返回而没有任何警告或错误。

I run it in interactive mode with sudo , that's how I figured out it returned at the setup() function. 我使用sudo在交互模式下运行它,这就是我发现它在setup()函数中返回的方式。

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()

Ok, installing the beta version of RPi.GPIO fixed the problem. 好的,安装RPi.GPIO的beta版可以解决此问题。

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 : //www.raspberrypi.org/forums/viewtopic.php?f=32&t=113014&p=773725

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM