我的Raspbeery Pi有问题,它连接在GPIO7引脚的继电器盒中。我曾与Gpio.board
与gpio.bcm
测试不使用此代码的成功:将Raspberry Pi连接到GPIO7引脚时出错
#This program connects with gpio7
#setup pins
#GPIO.setmode(GPIO.BOARD)
GPIO.setmode(GPIO.BCM)
GPIO.setup(4, GPIO.OUT)
#GPIO.setup(7, GPIO.OUT)#mode Board
while True:
GPIO.output(4, GPIO.HIGH)
#GPIO.output(7, GPIO.HIGH)#mode Board
time.sleep(5)
GPIO.output(4, GPIO.LOW)
#GPIO.output(7, GPIO.LOW) #mode Board
GPIO.cleanup() #devuelve los pines a su estado inicial
exit()
这是错误都以一种方式,另:
Traceback (most recent call last):File"/home/pi/Desktop/RelayPrograms/5_7OnSleepOff.py", line 13, in GPIO.output(4, GPIO.HIGH)RuntimeError: Please set pin numbering mode using GPIO.setmode(GPIO.BOARD) or GPIO.setmode(GPIO.BCM)
我缺少的东西?
您也可以尝试在[为Raspberri丕专用堆栈交易所网站(https://raspberrypi.stackexchange.com ) – imTachu
感谢您的贡献Lorena也将在此社区中沟通我的问题 –