【问题标题】:How can I get an LED to light on Google Assistant listening?如何让 LED 在 Google Assistant 收听时亮起?
【发布时间】:2017-05-27 17:24:48
【问题描述】:

经过长时间的研究没有任何结果,我在这里试试运气。我最近获得了 GA SDK 示例,可以在我的 Raspberry Pi 3 上运行。

现在我想在 Google 助理正在收听时点亮已连接的 LED。我知道该怎么做,但我不知道在助手示例代码中在哪里添加 LED 的代码。他们网站上的文档说它在 grpc 代码中,但我不知道更多。

关于在哪里添加 LED 代码有什么建议吗?

【问题讨论】:

  • 您使用的是哪个样本?
  • @proppy 我正在使用树莓派的 python sdk 示例
  • 哪个版本?以及哪个包(google-assistant-librarygoogle-assistant-grpc)?
  • @proppy google-assistant-library 版本 0.0.2

标签: python grpc google-assistant-sdk


【解决方案1】:

在此处查看启动指令示例https://github.com/googlesamples/assistant-sdk-python/blob/master/google-assistant-sdk/googlesamples/assistant/library/hotword.py

您可以使用这些事件来编写 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/

【讨论】:

  • 你指的是哪个assistant.py?
  • 好的,我自己在其他线程的帮助下找到了解决方案。自从您解决了我最初的问题后,我会将您的答案标记为正确。
猜你喜欢
  • 1970-01-01
  • 2017-12-18
  • 1970-01-01
  • 1970-01-01
  • 2018-07-31
  • 2020-06-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多