Hi guys,
Have someone of you worked with 1sheeld voice recognize ?
I am making an autonomous robot voice controlled.
I am using arduino mega adk and isheeld.
what I can't do is keeping the voice recognizer in listening state until a command is received.
the command to activate it, without touching the screen is VoiceRecognition.start();
but it doesn't stay HIGH
this is my code for now
any info or peace of mind is good about 1sheeld
thanks for the help
/*
Voice Recognition Shield Example
This example shows an application on 1Sheeld's voice recognition shield.
By using this example, you can play, pause and stop your smartphone's
music using voice commands.
OPTIONAL:
To reduce the library compiled size and limit its memory usage, you
can specify which shields you want to include in your sketch by
defining CUSTOM_SETTINGS and the shields respective INCLUDE_ define.
*/
#define CUSTOM_SETTINGS
#define INCLUDE_VOICE_RECOGNIZER_SHIELD
#define INCLUDE_MUSIC_PLAYER_SHIELD
#define INCLUDE_TERMINAL_SHIELD
#define INCLUDE_TEXT_TO_SPEECH_SHIELD
/* Include 1Sheeld library. */
#include <OneSheeld.h>
/* Voice commands set by the user. */
const char listenCommand[] = "tom";
const char playCommand[] = "play music";
const char pauseCommand[] = "pause";
const char stopCommand[] = "stop";
const char nextCommand[] = "next";
/* A command which will be compared. */
const char firstCommand[]="good morning tom";
/* A command which will be compared. */
const char secondCommand[]="how is the weather today";
/* A command which will be compared. */
const char thirdCommand[]="light on";
int ledPin = 13;
void setup()
{
/* Start Communication. */
OneSheeld.begin();
/* Error Commands handiling. */
VoiceRecognition.setOnError(error);
//void listener();
brainstart();
}
void loop ()
{
/* Check if new command received. */
//delay (3000);
}
/* Error checking function. */
void error(byte errorData)
{
/* Switch on error and print it on the terminal. */
switch(errorData)
{
case NETWORK_TIMEOUT_ERROR: Terminal.println("Network timeout");break;
case NETWORK_ERROR: Terminal.println("Network Error");break;
case AUDIO_ERROR: Terminal.println("Audio error");break;
case SERVER_ERROR: Terminal.println("No Server");break;
case SPEECH_TIMEOUT_ERROR: Terminal.println("Speech timeout");break;
case NO_MATCH_ERROR: Terminal.println("No match");break;
case RECOGNIZER_BUSY_ERROR: Terminal.println("Busy");break;
}
}
void brainstart()
{
delay (2000);
TextToSpeech.say("Hello master");
user:
delay(4000);
do {VoiceRecognition.start();
//delay(4000);
}
while (VoiceRecognition.isNewCommandReceived()==NULL);
delay(4000);
//delay(2000);
if(VoiceRecognition.isNewCommandReceived()==NULL)
{
delay(2000);
goto user;
}
if (RECOGNIZER_BUSY_ERROR==HIGH)
{
goto user;
}
if (RECOGNIZER_BUSY_ERROR==HIGH)
{
goto user;
}
/* Check if the voice command is the desired one. */
if(!strcmp(listenCommand,VoiceRecognition.getLastCommand()))
{
//MusicPlayer.pause();
TextToSpeech.say("yes my master");
goto user;
}
/* Check if the voice command is the desired one. */
else if(!strcmp(firstCommand,VoiceRecognition.getLastCommand()))
{
/* 1Sheeld responds using text-to-speech. */
TextToSpeech.say("Good morning master");
goto user;
}
/* Check if the voice command is the desired one. */
else if(!strcmp(secondCommand,VoiceRecognition.getLastCommand()))
{
/* 1Sheeld responds using text-to-speech. */
TextToSpeech.say("the weather is pretty good master");
goto user;
}
/* Check if the voice command is the desired one. */
else if(!strcmp(thirdCommand,VoiceRecognition.getLastCommand()))
{
digitalWrite(ledPin,HIGH);
/* 1Sheeld responds using text-to-speech. */
TextToSpeech.say("led turned on master");
goto user;
}
/* Compare the play command. */
else if(!strcmp(playCommand,VoiceRecognition.getLastCommand()))
{
/* Play the track. */
TextToSpeech.say("playing music master");
MusicPlayer.play();
goto user;
}
/* Compare the pause command. */
else if (!strcmp(pauseCommand,VoiceRecognition.getLastCommand()))
{
/* Pause the track. */
TextToSpeech.say("yes my master");
MusicPlayer.pause();
goto user;
}
/* Compare the stop command. */
else if (!strcmp(stopCommand,VoiceRecognition.getLastCommand()))
{
/* Stop the track. */
TextToSpeech.say("yes my master");
MusicPlayer.stop();
goto user;
}
/* Compare the next command. */
else if (!strcmp(nextCommand,VoiceRecognition.getLastCommand()))
{
/* Next track. */
TextToSpeech.say("yes my master");
MusicPlayer.next();
goto user;
}
}