擅长:python、mysql、java
<p>我同意爬行动物,你只需要添加一个while循环。”“whiletrue”将永远运行,直到您按下ctrl-C来中断。你只需要增加一秒延迟,在循环之前保持继电器关闭180秒。你可以创建一个不同的睡眠时间变量,或者我把你的睡眠时间乘以2。在</p>
<pre><code># main loop
while True:
try:
GPIO.output(14, GPIO.LOW)
print "open"
time.sleep(SleepTimeL);
GPIO.cleanup()
#Reset GPIO settings
GPIO.cleanup()
time.sleep(2*SleepTimeL)
# end program cleanly
except KeyboardInterrupt:
print "done"
</code></pre>