voicetools icon indicating copy to clipboard operation
voicetools copied to clipboard

为何要用传感器条件来判断

Open jhyetao opened this issue 7 years ago • 1 comments

    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()不行吗?

jhyetao avatar May 25 '17 05:05 jhyetao

因为这个示例代码的工作流程是唤醒 -> 接受指令,传感器是用来检测唤醒的。

namco1992 avatar May 31 '17 03:05 namco1992