![](/img/trans.png)
[英]AlarmSystem with the RPi (python3) RuntimeError: Conflicting edge detection already enabled for this GPIO channel
[英]Python RuntimeError GPIO
那里。 我試圖通過使用開關來運行腳本,以打開和關閉工作循環。
“開關引腳”是引腳13。通過此輸入,已經使用“ GPIO.setup(13,GPIO,IN)”進行了設置,我可以打開循環。 但是,當我試圖在循環內獲取輸入時,我會得到一個runtimerror(下面的代碼和回溯)。
while True:
d = datalogger(devmode)
d.set_sheet()
GPIO.setmode(GPIO.BOARD)
GPIO.setup(23, GPIO.IN)
GPIO.setup(3, GPIO.IN)
GPIO.setup(13, GPIO.IN)
GPIO.setup(22, GPIO.IN)
GPIO.setup(7, GPIO.OUT)
GPIO.output(7, GPIO.LOW)
print 'Ready !'
break
while 1:
if GPIO.input(13) == False:
d.runner(True)
break
else:
pass
while d.running:
GPIO.setup(13, GPIO.IN)
GPIO.add_event_detect(23, GPIO.FALLING, callback=d.hall_sens)
d.time_lauf()
d.abrieb_a()
d.read_temp()
d.clear_temp_log()
d.write_sheet()
d.print_data()
d.loop_break(looptime)
s = GPIO.input(13)
if s == 1:
d.runner(False)
else:
pass
GPIO.remove_event_detect(23)
Traceback (most recent call last):
file "file.py", line 260, in <module>
s = GPIO.input(13)
RuntimeError: You must setup() the GPIO channel first
但是我做到了
感謝幫助
使用BCM編號而不是板編號,然后再次聲明您的引腳。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.