Now that you have everything set up, it's time to use the Google Voice Assistant. Let's put a script on the Pi, run it and look at some of the things it can do.
First make sure you are in the Virtual Environment. If you have exited for some reason such as restarting the Pi, you can get back in by typing:
We wrote a script that will make use of the on-board DotStar LEDs and button on the BrainCraft HAT to make it easier to use the Google Assistant. Below is the full script. You can either save it onto your Pi by copying it below or you can type:
and it will save it directly to the Pi.
Google recently made a change that requires you to run a sample script that will associate your Hardware Model ID and Project ID for the main script to work. This step only needs to be done once. To get your Project ID you can open your client_secrets.json file and find it there.
If you saved your Model ID during the Google Setup, you're all set. If not, you can find it by following these steps.
Open the Actions console at https://console.actions.google.com/u/0/. Select your Project.
Click the Develop Tab at the top, then select Device Registration, then click on the product name.
Run the following command, swapping out [Your Project ID] and [Your Model ID] with the appropriate values:
googlesamples-assistant-pushtotalk --project-id [Your Project ID] --device-model-id [Your Model ID]
Press Control-C to exit the script. Now you're ready to run the project script.
To run the main script, type:
Wait a few seconds until the script tells you to press a button and then press the button on the BrainCraft HAT. The lights should turn green, meaning it is waiting for you to give it a command or ask a question.