如何让Google智能助理监听LED?
问题描述:
经过长期研究没有任何结果,我试着在这里运气。我最近得到了GA SDK示例,以在我的Raspberry Pi 3上工作。如何让Google智能助理监听LED?
现在,我想在助手正在收听时点亮连接的LED。我知道如何做到这一点,但我不知道在助手示例代码中添加LED代码的位置。他们网站上的文档说它在grpc代码中,但我不知道更多。
任何关于在哪里添加LED代码的建议?
答
您可以使用事件来写你的GPIO逻辑来开启/关闭的LED。 事情是这样的 -
`def process_event(event):
if event.type == EventType.ON_CONVERSATION_TURN_STARTED:
print()
GPIO.output(25,True)
if (event.type == EventType.ON_CONVERSATION_TURN_FINISHED and
event.args and not event.args['with_follow_on_turn']):
print()
GPIO.output(25,False)
if (event.type == EventType.ON_RECOGNIZING_SPEECH_FINISHED and
event.args and not event.args['with_follow_on_turn']):
print()`
这里的库 - https://developers.google.com/assistant/sdk/reference/library/python/
您正在使用哪个样品的文件? – proppy
@proppy我正在使用python sdk sample for raspberry pi – Jan
哪个版本?和哪个软件包('google-assistant-library'或'google-assistant-grpc')? – proppy