voicetools
voicetools copied to clipboard
为何要用传感器条件来判断
while True:
# 下降沿检测
if GPIO.event_detected(GPIOConfig.VOICE_SENSOR):
GPIO.remove_event_detect(GPIOConfig.VOICE_SENSOR)
handler.worker()
GPIO.add_event_detect(GPIOConfig.VOICE_SENSOR, GPIO.FALLING)
time.sleep(0.5)
上面代码,为何要用传感器条件来判断,直接循环执行handler.work()不行吗?
因为这个示例代码的工作流程是唤醒 -> 接受指令,传感器是用来检测唤醒的。