using Easyvr with motor driver

hello guys
I am using Easyvr with motor driver , when i mounted the motor driver shield over the Easyvr shield , Easyvr stopped listening to commands ,can this problem be solved ???
by the way i am mounting the easyvr shield over arduino uno and the motor driver shield over the the easyvr sheild
thanks in advance for your help

aleem

#if defined(ARDUINO) && ARDUINO >= 100
  #include "Arduino.h"
  #include "SoftwareSerial.h"
  #include <AFMotor.h>
  SoftwareSerial port(12,13);
#else // Arduino 0022 - use modified NewSoftSerial
  #include "WProgram.h"
  #include "NewSoftSerial.h"
  #include <AFMotor.h>
  NewSoftSerial port(12,13);
#endif

#include "EasyVR.h"
EasyVR easyvr(port);
AF_DCMotor motor(2);
//Groups and Commands
enum Groups
{
  GROUP_0  = 0,
  GROUP_1  = 1,
  GROUP_4  = 4,
  GROUP_5  = 5,
};

enum Group0 
{
  G0_ALEEM = 0,
};

enum Group1 
{
  G1_GO = 0,
};

enum Group4 
{
  G4_ONE = 0,
  G4_TOW = 1,
  G4_THREE = 2,
  G4_FOUR = 3,
  G4_FIVE = 4,
  G4_SIX = 5,
  G4_SEVEN = 6,
  G4_EIGHT = 7,
};

enum Group5 
{
  G5_LEFT = 0,
  G5_RIGHT = 1,
  G5_UP = 2,
  G5_DOWN = 3,
  G5_FORWARD = 4,
  G5_BACKWORD = 5,
};


EasyVRBridge bridge;

int8_t group, idx;
//AF_DCMotor motor(4);


void setup()
{
   motor.setSpeed(1000);
   // motor1.setSpeed(1000);
 // pinMode(5,OUTPUT);
 // pinMode(6,OUTPUT);
  // bridge mode?
  if (bridge.check())
  {
    cli();
    bridge.loop(0, 1, 12, 13);
  }
  // run normally
  Serial.begin(9600);
  port.begin(9600);

  if (!easyvr.detect())
  {
    Serial.println("EasyVR not detected!");
    for (;;);
  }

  easyvr.setPinOutput(EasyVR::IO1, LOW);
  Serial.println("EasyVR detected!");
  easyvr.setTimeout(5);
  easyvr.setLanguage(0);

  group = 5;//EasyVR::TRIGGER; //<-- start group (customize)
}

void action();

void loop()
{
  easyvr.setPinOutput(EasyVR::IO1, HIGH); // LED on (listening)

  Serial.print("Say a command in Group ");
  Serial.println(group);
  easyvr.recognizeCommand(group);

  do
  {
    // can do some processing while waiting for a spoken command
  }
  while (!easyvr.hasFinished());
  
  easyvr.setPinOutput(EasyVR::IO1, LOW); // LED off

  idx = easyvr.getWord();
  if (idx >= 0)
  {
    // built-in trigger (ROBOT)
    // group = GROUP_X; <-- jump to another group X
    return;
  }
  idx = easyvr.getCommand();
  if (idx >= 0)
  {
    // print debug message
    uint8_t train = 0;
    char name[32];
    Serial.print("Command: ");
    Serial.print(idx);
    if (easyvr.dumpCommand(group, idx, name, train))
    {
      Serial.print(" = ");
      Serial.println(name);
    }
    else
      Serial.println();
    easyvr.playSound(0, EasyVR::VOL_FULL);
    // perform some action
    action();
  }
  else // errors or timeout
  {
    if (easyvr.isTimeout())
      Serial.println("Timed out, try again...");
    int16_t err = easyvr.getError();
    if (err >= 0)
    {
      Serial.print("Error ");
      Serial.println(err, HEX);
    }
  }
}

void action()
{
    switch (group)
    {
    case GROUP_0:
      switch (idx)
      {
      case G0_ALEEM:
        // write your action code here
        // group = GROUP_X; <-- or jump to another group X for composite commands
        break;
      }
      break;
    case GROUP_1:
      switch (idx)
      {
      case G1_GO:
        // write your action code here
        // group = GROUP_X; <-- or jump to another group X for composite commands
        break;
      }
      break;
    case GROUP_4:
      switch (idx)
      {
      case G4_ONE:
        // write your action code here
        // group = GROUP_X; <-- or jump to another group X for composite commands
        break;
      case G4_TOW:
        // write your action code here
        // group = GROUP_X; <-- or jump to another group X for composite commands
        break;
      case G4_THREE:
        // write your action code here
        // group = GROUP_X; <-- or jump to another group X for composite commands
        break;
      case G4_FOUR:
        // write your action code here
        // group = GROUP_X; <-- or jump to another group X for composite commands
        break;
      case G4_FIVE:
        // write your action code here
        // group = GROUP_X; <-- or jump to another group X for composite commands
        break;
      case G4_SIX:
        // write your action code here
        // group = GROUP_X; <-- or jump to another group X for composite commands
        break;
      case G4_SEVEN:
        // write your action code here
        // group = GROUP_X; <-- or jump to another group X for composite commands
        break;
      case G4_EIGHT:
        // write your action code here
        // group = GROUP_X; <-- or jump to another group X for composite commands
        break;
      }
      break;
    case GROUP_5:
      switch (idx)
      {
      case G5_LEFT:
   
     
        break;
      case G5_RIGHT:
  
        break;
      case G5_UP:
     
        // write your action code here
        // group = GROUP_X; <-- or jump to another group X for composite commands
        break;
      case G5_DOWN:
     
        // write your action code here
        // group = GROUP_X; <-- or jump to another group X for composite commands
        break;
      case G5_FORWARD:
   
       motor.setSpeed(0);
       motor.run(FORWARD);
      delay(1000);
      
          break;
      case G5_BACKWORD:
   
     motor.setSpeed(1000);
     motor.run(BACKWARD);
      
     delay(1000);
     
     
        // write your action code here
        // group = GROUP_X; <-- or jump to another group X for composite commands
        break;
      }
      break;
    }
}

easyvr_with_motor.txt (5.36 KB)

I had to google "easyVR". Please include links to your components in future posts.

Does the motor shield work without the EasyVr in between? Does the EasyVR work with the motorshield software (but not the shield) ? Try other combinations - it may give you a clue. Also try the standard Blink sketch, does it work with both shields (to see if you have short, too much power consumption and so on)

ok , that was great tutriol , what if use the motor shield in whitch the L293 can be put on ??? I am acually suing it with easyvr shied http://garagelab.com/profiles/blogs/tutorial-voice-recognition-with-arduino
and i am using the motor driver shield on top of the easyvr shield http://playground.arduino.cc/Main/AdafruitMotorShield
every thing goes fine until I define object of the AF_DCmotor , the easyvr stopes listening to my voice commands ?
this is the code
#if defined(ARDUINO) && ARDUINO >= 100
#include “Arduino.h”
#include “SoftwareSerial.h”
#include <AFMotor.h>
SoftwareSerial port(12,13);
#else // Arduino 0022 - use modified NewSoftSerial
#include “WProgram.h”
#include “NewSoftSerial.h”
#include <AFMotor.h>
NewSoftSerial port(12,13);
#endif

#include “EasyVR.h”
EasyVR easyvr(port);
AF_DCMotor motor(2);
//Groups and Commands
enum Groups
{
GROUP_0 = 0,
GROUP_1 = 1,
GROUP_4 = 4,
GROUP_5 = 5,
};

enum Group0
{
G0_ALEEM = 0,
};

enum Group1
{
G1_GO = 0,
};

enum Group4
{
G4_ONE = 0,
G4_TOW = 1,
G4_THREE = 2,
G4_FOUR = 3,
G4_FIVE = 4,
G4_SIX = 5,
G4_SEVEN = 6,
G4_EIGHT = 7,
};

enum Group5
{
G5_LEFT = 0,
G5_RIGHT = 1,
G5_UP = 2,
G5_DOWN = 3,
G5_FORWARD = 4,
G5_BACKWORD = 5,
};

EasyVRBridge bridge;

int8_t group, idx;
//AF_DCMotor motor(4);

void setup()
{
motor.setSpeed(1000);
// motor1.setSpeed(1000);
// pinMode(5,OUTPUT);
// pinMode(6,OUTPUT);
// bridge mode?
if (bridge.check())
{
cli();
bridge.loop(0, 1, 12, 13);
}
// run normally
Serial.begin(9600);
port.begin(9600);

if (!easyvr.detect())
{
Serial.println(“EasyVR not detected!”);
for (;;);
}

easyvr.setPinOutput(EasyVR::IO1, LOW);
Serial.println(“EasyVR detected!”);
easyvr.setTimeout(5);
easyvr.setLanguage(0);

group = 5;//EasyVR::TRIGGER; //<-- start group (customize)
}

void action();

void loop()
{
easyvr.setPinOutput(EasyVR::IO1, HIGH); // LED on (listening)

Serial.print("Say a command in Group ");
Serial.println(group);
easyvr.recognizeCommand(group);

do
{
// can do some processing while waiting for a spoken command
}
while (!easyvr.hasFinished());

easyvr.setPinOutput(EasyVR::IO1, LOW); // LED off

idx = easyvr.getWord();
if (idx >= 0)
{
// built-in trigger (ROBOT)
// group = GROUP_X; ← jump to another group X
return;
}
idx = easyvr.getCommand();
if (idx >= 0)
{
// print debug message
uint8_t train = 0;
char name[32];
Serial.print("Command: “);
Serial.print(idx);
if (easyvr.dumpCommand(group, idx, name, train))
{
Serial.print(” = ");
Serial.println(name);
}
else
Serial.println();
easyvr.playSound(0, EasyVR::VOL_FULL);
// perform some action
action();
}
else // errors or timeout
{
if (easyvr.isTimeout())
Serial.println(“Timed out, try again…”);
int16_t err = easyvr.getError();
if (err >= 0)
{
Serial.print("Error ");
Serial.println(err, HEX);
}
}
}

void action()
{
switch (group)
{
case GROUP_0:
switch (idx)
{
case G0_ALEEM:
// write your action code here
// group = GROUP_X; ← or jump to another group X for composite commands
break;
}
break;
case GROUP_1:
switch (idx)
{
case G1_GO:
// write your action code here
// group = GROUP_X; ← or jump to another group X for composite commands
break;
}
break;
case GROUP_4:
switch (idx)
{
case G4_ONE:
// write your action code here
// group = GROUP_X; ← or jump to another group X for composite commands
break;
case G4_TOW:
// write your action code here
// group = GROUP_X; ← or jump to another group X for composite commands
break;
case G4_THREE:
// write your action code here
// group = GROUP_X; ← or jump to another group X for composite commands
break;
case G4_FOUR:
// write your action code here
// group = GROUP_X; ← or jump to another group X for composite commands
break;
case G4_FIVE:
// write your action code here
// group = GROUP_X; ← or jump to another group X for composite commands
break;
case G4_SIX:
// write your action code here
// group = GROUP_X; ← or jump to another group X for composite commands
break;
case G4_SEVEN:
// write your action code here
// group = GROUP_X; ← or jump to another group X for composite commands
break;
case G4_EIGHT:
// write your action code here
// group = GROUP_X; ← or jump to another group X for composite commands
break;
}
break;
case GROUP_5:
switch (idx)
{
case G5_LEFT:

break;
case G5_RIGHT:

break;
case G5_UP:

// write your action code here
// group = GROUP_X; ← or jump to another group X for composite commands
break;
case G5_DOWN:

// write your action code here
// group = GROUP_X; ← or jump to another group X for composite commands
break;
case G5_FORWARD:

motor.setSpeed(0);
motor.run(FORWARD);
delay(1000);

break;
case G5_BACKWORD:

motor.setSpeed(1000);
motor.run(BACKWARD);

delay(1000);

// write your action code here
// group = GROUP_X; ← or jump to another group X for composite commands
break;
}
break;
}
}

thanks in advance for your help

i think , easyvr uses pins 12 , 13 and the motor driver shield uses Digital pins: used: 3,4,5,6,7,8,9,10,11,12 which makes easyvr stops listening thanks in advance for your help