voiceWaveOnHello

voiceWaveOnHello

mimicArm Robot Arm Waves When You Say Hello

Using voiceRecognize we can determine what pre-programmed phrase has been received.  Specifically, we're looking for "Hello mimicArm". When the phrase is heard the robot will wave hello.

Commands Used

voiceActivate();

voiceSetGroup(x);

voiceAvailable();

voiceRecognize();

 

voiceWaveOnHello.ino


Cut and paste code:

#include <robot.h>

void setup() {
  Serial.begin(9600);
  voiceActivate();  //Lets Arduino know to get ready for voice commands. Initializes software serial bus on pins 2 and 3.
  if (!voiceEnable()) {
    Serial.println("Voice recognition module failed to initialize");    //Tells the voice recognition module to start listning
    voiceSetGroup(1);   //Tell the module to listen for words in group 1
  }
  else Serial.println("Voice recognition module initialized");

  robotActivate();  //Tell Arduino that robot commands are coming. Initializes software serial on pins 8 and 9

  robotMode(Arduino);  //disable manual control

  robotMove(1, 127); //Center the robot on it's base
  robotMove(2, 127);  //Put the robots 'shoulder' in a natural position
  robotMove(3, 200);  //Put robot 'elbow' at botom of wave
}

void loop() {
  // put your main code here, to run repeatedly:
  if (voiceAvailable()) {  //check if the module has recieved any recognized words
    int voiceReturn = voiceRecognize();   //Download the number coresponding to the word stored in group 1
    if (voiceReturn = 1) { //"hello mimicArm" is stored in position 1. If it's recieved say so.
      Serial.println("recieved Hello mimicArm");
      robotMode(arduino);  //Put the robot in Arduino command mode

      robotMove(1, 127); //Center the robot on it's base
      robotMove(2, 127);  //Put the robots 'shoulder' in a natural position
      robotMove(3, 90);  //Put robot 'elbow' at botom of wave

      delay(1000);       //wait 1 second
      robotMove(3, 200); //put robot 'elbow at top of wave
      delay(1000);       //wait 1 second before starng over
    }
  }
}