Hi!
I got a problem with the easyVR!
Im using a Arduino Mega, EasyVR shield and a Bluetooth shield on top of that.
In my code i have the following lines:
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#include "SoftwareSerial.h"
SoftwareSerial port(12,13);
#else // Arduino 0022 - use modified NewSoftSerial
#include "WProgram.h"
#include "NewSoftSerial.h"
NewSoftSerial port(12,13);
#endif
if (bridge.check())
{
cli();
bridge.loop(0, 1, 12, 13);
}
This works fine, but i got a modular robot with 14 servos who needs the PWM-signal. So when i move the generated code from the easyVR commander into my code for all of the servos it bugs.
This is because the servos are using pins 2-13, 45 and 46 on the Mega(Mega have 14 PWM's and all are used for my servos).
So i get a conflict between the servos connected on pin 12 and 13 with the easyVR and the bridge.
So my question is, how can i solve this problem? Which source code needs to be changed so the easyVR can use other pins? Pin 0 and 1 RX/TX are not in use, but they're only for the HW mode ?
Another solution might be to make an ordinary DI to and PWM, so i can move my servos there, and keep the easyVR at 12 and 13? If this works, how is it done ?
Here's is some of the code, i had to remove alot cause the forum only allows 9500 characters, where i both have the code for my servo's and the code which is made with easyVR commander.
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#include "SoftwareSerial.h"
SoftwareSerial port(12,13);
#else // Arduino 0022 - use modified NewSoftSerial
#include "WProgram.h"
#include "NewSoftSerial.h"
NewSoftSerial port(12,13);
#endif
#include "EasyVR.h"
EasyVR easyvr(port);
//Groups and Commands
enum Groups
{
GROUP_0 = 0,
GROUP_1 = 1,
};
enum Group0
{
G0_ROBOT = 0,
};
enum Group1
{
G1_SIT = 0,
G1_STAA_PENT = 1,
G1_GAA = 2,
G1_DEKK = 3,
G1_VENSTRE = 4,
G1_HOYRE = 5,
G1_AUTOMATISK = 6,
G1_RESET = 7,
};
EasyVRBridge bridge;
int8_t group, idx;
#include <Servo.h>
Servo LeftWrist; // determines the first servo
Servo LeftElbow; // determines the second servo
Servo LeftShoulder; // determines the third servo
Servo RightShoulder; // determines the fourth servo
Servo RightElbow; // determines the fifth servo
Servo RightWrist; // determines the sixth servo
Servo Back; // determines the senventh servo
Servo Stomach; // determines the eighth servo
Servo Hip; // determines the nineth servo
Servo LeftAnkle; // determines the tenth servo
Servo LeftCalf; // determines the eleventh servo
Servo LeftThigh; // determines the twelveth servo
Servo RightThigh; // determines the thirtheenth servo
Servo RightCalf; // determines the fourteenth servo
Servo RightAnkle; // determines the fifteenth servo
//-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. Variables .-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
int t;
int fQ = 2000; // frequency
//-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
void setup() {
// bridge mode
if (bridge.check())
{
cli();
bridge.loop(0, 1, 12, 13);
}
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 = EasyVR::TRIGGER;
RightShoulder.attach(2); // attaches the servo on pin 3 to the servo object
RightElbow.attach(3); // attaches the servo on pin 3 to the servo object
RightWrist.attach(4); // attaches the servo on pin 3 to the servo object
LeftShoulder.attach(5); // attaches the servo on pin 3 to the servo object
LeftElbow.attach(6); // attaches the servo on pin 3 to the servo object
LeftWrist.attach(7); // attaches the servo on pin 3 to the servo object
Back.attach(45); // attaches the servo on pin 3 to the servo object
Hip.attach(46); // attaches the servo on pin 3 to the servo object
LeftAnkle.attach(8); // attaches the servo on pin 3 to the servo object
LeftCalf.attach(9); // attaches the servo on pin 3 to the servo object
LeftThigh.attach(10); // attaches the servo on pin 3 to the servo object
RightThigh.attach(11); // attaches the servo on pin 3 to the servo object
//RightCalf.attach(12); // attaches the servo on pin 3 to the servo object
//RightAnkle.attach(13); // attaches the servo on pin 3 to the servo object
}
Here's a few picture of my school project, it is suppose to be a H-shaped modular robot with possibility to move in different patterns (Dog, reptile etc..) It is also controlled with an application on a phone, communication true bluetooth. And now im trying to get the easyVR to work.
Here's a pictures of it.
![](http://
// Oyvind_Olsen)