project.properties
and select “Yes, I trust confirmation”.
The src/main.cpp
code included in the zip file detects the trained keyword, and prints predictions over serial console. So we need to add some code to control the Relay.
We will open src/main.cpp
and add the following:
Note: you can also download the main.cpp
file from https://github.com/ronibandini/Photon2VoiceCommand to make sure you have everything entered correctly.
Now press Ctrl+Shift+P to bring up the Particle menu again, and this time select “Particle: Configure Project for Device”. Select deviceOS@5.5.0, board P2, and ESC for device name.
Note: if you get a Microphone library not found, press Ctrl+Shift+P, install the ‘Microphone_PDM@0.0.2’ library.Finally, bring up the Particle menu again with Ctrl+Shift+P and select “Particle: Flash application and device, local” (For Windows, it will take around 5 minutes to flash).
main.cpp
modifications were made following the work done by Particle for this example https://docs.particle.io/getting-started/machine-learning/youre-muted
sudo apt-get install libarchive-zip-perl
(this step is to avoid an error where crc32 tool is not found)particle.particle-vscode-pack
and press Enter.