May 29, 2019 at 8:35 PM #178777lincolnbsouzaParticipant
I am trying to begin voice recognition from a sound trigger (like saying “OK” loud). I don’t want to push a button or depend on a time loop. So I decided to use the “Mic.getValue()” function and checking if is more than 70. Then my problems begun… please see code below:
1. The loop works fine if I put “71” in place of “Mic.getvalue()” – this is basically a know example
2. If I put “Mic.getValue()” as in the code below, the voice recoginition doesn’t works and a “NETWORK ERROR” comes rapidly
3. If I get back to use “71”, recompile and reload, it continues to get “NETWORK ERROR” until I close 1Sheeld application on mobile, AND restart my mobile phone.. It seems that only closing 1Sheeld application is not enough… some thing seems to go wrong in the mobile phone network connection…
4. Extra info: this happens using the same good WiFi connection, mobile Samsung S9+, Android 9, 1Sheeld Firmware 1.6, Arduino Nano
So, is there any incompatibility between Mic and Voice Recognizer shields ? Or there are some hints to make the code below work properly ?
char commandReceived; // maximum voice command characters are 300
OneSheeld.begin(); // Começar comunicação com o 1Sheeld
VoiceRecognition.setOnError(error); // Tratar erros de Voice Recognition
void loop ()
if (Mic.getValue() > 70)
strcpy(commandReceived , VoiceRecognition.getLastCommand());
/* delay before listening again to process the received command */
}June 11, 2019 at 12:57 PM #193274AmrKeymaster
Actually, you got it right since both voice recognition shield and mic shield use the same phone hardware resource; the MIC! This makes the conflict so you CAN’T use both shields at the same time.
Sorry for this but I have forward the issue to the App development team and they will work on it.
By the way, your code has some issues you should take care of:
– you are not making the strings compare properly, as you need to use the “!” before the strcmp(commandReceived, VoiceRecognition.getLastCommand()) function and put it inside an if condition like this:
if (!strcmp(commandReceived, VoiceRecognition.getLastCommand()))
– the commandReceived variable hasn’t been initialized yet so it will hold garbage characters and the code will not know what you are comparing with!
– VoiceRecognition.setOnError(error); makes an error so I guess you deleted the “error()” function before you upload the code here.
You must be logged in to reply to this topic.