This is a quick tutorial on adding button trigger for google assistant on raspberry pi, this tutorial was very straight forward and should take that much time to perform to add this action.
○○○ Parts ○○○
Momentary Switch ► http://amzn.to/2qUoGf2
LED ► http://amzn.to/2qkgBnP
resistor 220 ohm ► http://amzn.to/2pfiAto
USB Microphone ► http://amzn.to/2qCx4zY
Raspberry Pi 3 ► http://amzn.to/2oquADd
Installing the RPi.GPIO
pip install RPi.GPIO
edit google samples assistant main.py file
on the top of the file we need to import gpio
import RPi.GPIO as GPIO
now we have to setup our pins
GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_UP)
now we need to add the trigger to our code at line 197
comment out with #click.pause…..
input_state = GPIO.input(18)
if input_state == True:
remember to double check the indents, google likes to use 4 spaces in place of tab spacing.
if you want more details about this project, consider checking out one of my previous post about installing google assistant on raspberry pi