|
最近上手搞了一块RPI2玩,玩得一切都顺利,操作系统、各种服务搭得都很好。现在开始搞GPIO的编程处理,但彻底挂了,Python的相关安装一切顺利,python也做了几个小程序,但是执行时,针脚输出都没反应。(Python程序是最简单,从网上拷贝的,针脚编号也已经排查过了,没有问题)
重新安装BCM2835的库,安装完后、编译执行代码,也是一样,执行任何报错,但是针脚无输出。
再安装WebIOPi,安装成功后,启动正常,但是打开针脚控制页面,又报错,报错如下:
----------------------------------------
Exception happened during processing of request from ('192.168.199.11', 58828)
Traceback (most recent call last):
File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.1-py3.2-linux-armv7l.egg/webiopi/protocols/http.py", line 238, in processRequest
result = self.server.handler.do_GET(relativePath, compact)
File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.1-py3.2-linux-armv7l.egg/webiopi/protocols/rest.py", line 147, in do_GET
return (200, self.getJSON(compact), M_JSON)
File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.1-py3.2-linux-armv7l.egg/webiopi/protocols/rest.py", line 245, in getJSON
gpios[gpio][f] = GPIO.getFunctionString(gpio)
NameError: global name 'GPIO' is not defined
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.2/socketserver.py", line 295, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/lib/python3.2/socketserver.py", line 321, in process_request
self.finish_request(request, client_address)
File "/usr/lib/python3.2/socketserver.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python3.2/socketserver.py", line 648, in __init__
self.handle()
File "/usr/lib/python3.2/http/server.py", line 396, in handle
self.handle_one_request()
File "/usr/lib/python3.2/http/server.py", line 384, in handle_one_request
method()
File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.1-py3.2-linux-armv7l.egg/webiopi/protocols/http.py", line 267, in do_GET
self.processRequest()
File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.1-py3.2-linux-armv7l.egg/webiopi/protocols/http.py", line 258, in processRequest
except (GPIO.InvalidDirectionException, GPIO.InvalidChannelException, GPIO.SetupException) as e:
NameError: global name 'GPIO' is not defined
============================================
已经彻底奔溃了,GPIO的针脚真的是一点反应都没有啊,用万用表量了,读数动也不动。请论坛里的大侠帮忙看看,是否有什么设置没考虑到或是其他情况。还是我的RPI烧了?拜谢拜谢~
|
|