Control HaloCode's LEDs via Voice Command
Sign in to mBlock 5
HaloCode needs to connect to the internet to use online speech recognition service. We need to sign in to mBlock 5 first.
Connect to the internet
1. Drag an Events blockand a Wi-Fi block . Input the Wi-Fi name and password.
2. We want to know when the Wi-Fi is successfully connected. Add a Control block, a Wi-Fi block , and a Lighting block .
When the button is pressed, all LEDs will light up orange. The recognition process lasts for 2 seconds. When it's done, LED 1 will light up green.
3. Add an Events blocksand a Lighting block . Change the color to orange. Then add a Control block and a Lighting block .
4. Add a Wi-Fi block, and a Lighting block to light off all LEDs after the speech recognition is done.
5. Add a Control blockand an Operators block . Add Wi-Fi block to the first box and input "blue" to the second box. If the speech recognition result contains "blue", all LEDs will light up blue. Add a Lighting block
6. Likewise, we can recognize "red".
7. Upload the program. When HaloCode connects to the internet successfully, try pressing the button and say "red" to the microphone. Then check the LEDs.