Raspberry PI 2 GPIO.setup()退出无任何错误 [英] Raspberry PI 2 GPIO.setup() exits without any error

查看:117
本文介绍了Raspberry PI 2 GPIO.setup()退出无任何错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Pi2,并希望运行带头的示例.但是由于某些原因,GPIO.setup(11, GPIO.OUT)总是返回而没有任何警告或错误.

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.

我使用sudo在交互模式下运行它,这就是我弄清楚它在setup()函数中返回的方式.

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.

这是我运行的命令.

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

推荐答案

好,安装beta版本的RPi.GPIO可以解决此问题.

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

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

这篇关于Raspberry PI 2 GPIO.setup()退出无任何错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆