嘿,伙计们,我每次都知道失败:
photo_booth.py:18: RuntimeWarning:这个频道已经在使用了,反正还在继续。使用GPIO.setwarnings(False)禁用警告。 GPIO.setup(松弛,GPIO.OUT)
我也尝试用GPIO 18来控制所有继电器,但它根本不起作用。我和其他人试过了,但没什么改变。放松我一直在进行,它没有关闭与命令。我的问题是什么?
你能告诉我这个问题吗?
#!/usr/bin/python
import RPi.GPIO as GPIO, time, os, subprocess, signal
# GPIO setup
GPIO.setmode(GPIO.BCM)
SWITCH = 24
GPIO.setup(SWITCH, GPIO.IN)
RESET = 25
GPIO.setup(RESET, GPIO.IN)
RELAI = 19
GPIO.setup(RELAI, GPIO.OUT)
GPIO.output(RELAI, GPIO.LOW)
j = 0
k = 0
def entprellen(schalter):
entprellungs_puffer = 0
schalter_puffer = 0
for i in range(1, 11):
entprellungs_puffer = entprellungs_puffer +1
schalter_puffer = schalter_puffer + schalter
time.sleep(0.05)
if entprellungs_puffer == schalter_puffer:
print("entprellt")
return 1
else:
return 0
while True:
if(GPIO.input(SWITCH)):
j = entprellen(GPIO.input(SWITCH))
if (j):
GPIO.output(RELAI,GPIO.LOW)
time.sleep(0.5)
print("pose!")
print("SNAP")
gpout = subprocess.check_output("gphoto2 --capture-image-and-download --filename /home/pi/photobooth_images/photobooth%H%M%S.jpg", stderr=subprocess.STDOUT, shell=True)
print(gpout)
print("please wait while your photos print...")
subprocess.call("sudo /home/pi/scripts/photobooth/assemble_and_print", shell=True)
time.sleep(10)
print("ready for next round")
GPIO.output(RELAI,GPIO.HIGH)
GPIO.cleanup()发布于 2019-02-06 21:21:33
谢谢,“stevieb”和“johnny是的,我理解BCM和董事会模式之间的区别。”实际上它是可以跑的。问题是:我像这里一样连接它,https://www.youtube.com/watch?v=TVR2SCMN8xY,但是它没有工作。然后我试着把π上的电压从5变到3.3V,它起了作用。问题是继电器没有正确切换。我的红色在很多方面都很不同,对继电器的想法很不一样。所以我不知道该怎么做。我现在有两个接力台:
这是第一个:s00?ie=UTF8&psc=1
这几乎相同,但不同的品牌:s00?ie=UTF8&psc=1,我希望第二个是更好的,因为它是一样的,如教程所示。但没有任何变化。现在我买了这个:https://www.ebay.de/itm/252993630298,它有一个引脚直接供应线圈的5V和3.3是用于开关。
你认为它会成功还是你有其他的想法?
谢谢你的帮助!
https://stackoverflow.com/questions/54540058
复制相似问题