Thanks Patrick. I manage to get SetMultiTarget to work but I run into the same issue as this guy.
Sometimes the servos will go to the desired position and jitter and sometime just jerk but cannot go to the desired position.
let me explain how I wiring my Mini Maestro ,Mega2560 and Servo.
- Mini maestro-24 connect to usb=> to my PC.
- Mini maestro-24 get servo power from external power supply DC6V. I am sure that this external power supply has enough power supply to my 4 servos
- Mega2560 connect to usb=> to my PC.
- ground is connect from Mega2560=>Maestro-24 and external power supply
- Maestro-24 RX connect to Meag2560 pin 11 , Maestro-24 TX connect to Meag2560 pin 10
- 4 units Servo connect to Maestro-24 at pin 0-3
I monitor the error log while the Arduino is communicating with the maestro, the maestro works perfectly and all the servos go to the desired positions no problem - no errors listed. Do you guys have any idea what the problem is? below is my code.
#include <PololuMaestro.h>
#include <SoftwareSerial.h>
SoftwareSerial maestroSerial(10, 11);
uint16_t BeginArray={4000,4000,4000,4000};
uint16_t EndArray={7000,7000,7000,7000};
//MicroMaestro maestro(maestroSerial);
MiniMaestro maestro(maestroSerial);
void setup()
{
pinMode(10,INPUT); //set rx (or pin 0) as input
pinMode(11, OUTPUT); //set tx (or pin 1) as output
maestroSerial.begin(115200);
maestro.setSpeed(0, 100);
maestro.setAcceleration(0,60);
maestro.setSpeed(1, 100);
maestro.setAcceleration(1,60);
maestro.setSpeed(2, 100);
maestro.setAcceleration(2,60);
maestro.setSpeed(3, 100);
maestro.setAcceleration(3,60);
}
void loop()
{
maestro.setMultiTarget(4,0,BeginArray);
delay(4000);
maestro.setMultiTarget(4,0,EndArray);
delay(4000);
}
