我正在制作一个3x3x3 LED立方体,我正试图用Raspberry Pi控制它。我找到了一个适合它的脚本,但是我得到了这个错误(开始时):
sudo python led.py
Traceback (most recent call last):
File "led.py", line 9, in <module>
GPIO.setmode(GPIO.BOARD)
AttributeError: 'module' object has no attribute 'setmode'
代码差不多是800行,所以我不会把它放在这里。您可以从google docs wave.py
下载它这是前九行:
1 #!/usr/bin/env/python3.2
2 # 3x3 LED Cube
3 # Position 11 - 33 are connected to LED Cathode (-)
4 # Layers are connected to LED Anode (+)
5
6 import RPi.GPIO as GPIO
7 from time import sleep
8
9 GPIO.setmode(GPIO.BOARD)
修改
现在我以root身份运行它并得到一个新错误:
File "led.py", line 382
i = 0
^
SyntaxError: invalid syntax