I've hooked up 15 servos (Towerpro MG996R) to your PCA9685 and an Arduino Uno.
I'm powering the servos 6.4 v with a 10A power source through the V+ pin.
The Servo example in your library works fine, moving one servo at a time.
But when I try to sweep all the servos together I run into problems.
I'm using the following code:
Code: Select all
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
#define Min 150
#define Max 500
int pulselen;
int myservo;
void setup() {
Serial.begin(9600);
pwm.begin();
pwm.setOscillatorFrequency(27000000);
pwm.setPWMFreq(50); // Analog servos run at ~50 Hz updates
delay(10);
}
void loop() {
for ( pulselen = Min; pulselen < Max; pulselen += 2) {
for (myservo = 0; myservo < 15; myservo++) {
pwm.setPWM(myservo, 0, pulselen);
delay(5);
}
}
for (pulselen = Max; pulselen > Min; pulselen -=2 ) {
for (myservo = 0; myservo < 15; myservo++){
pwm.setPWM(myservo, 0, pulselen);
delay(5);
}
}
}
Incrementing the "pulselen" by 2, servos sweep real slowly and any higher value gives strange results. i.e. some servos move, some don't and some jump.
I need to be able to sweep all the servos together, much faster and with different speeds.
Appreciate your help.