steve that is exactly what i am saying.
here the code:
its a slightly altered version of the ADAFFRUIT demo code for the servo controller
/***************************************************
This is an example for our Adafruit 16-channel PWM & Servo driver
Servo test - this will drive 8 servos, one after the other on the
first 8 pins of the PCA9685
Pick one up today in the adafruit shop!
------> http://www.adafruit.com/products/815
These drivers use I2C to communicate, 2 pins are required to
interface.
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, all text above must be included in any redistribution
****************************************************/
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>
// called this way, it uses the default address 0x40
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
// you can also call it with a different address you want
//Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(0x41);
// you can also call it with a different address and I2C interface
//Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(0x40, Wire);
// Depending on your servo make, the pulse width min and max may vary, you
// want these to be as small/large as possible without hitting the hard stop
// for max range. You'll have to tweak them as necessary to match the servos you
// have!
#define SERVOMIN 150 // This is the 'minimum' pulse length count (out of 4096)
#define SERVOMAX 600 // This is the 'maximum' pulse length count (out of 4096)
#define USMIN 600 // This is the rounded 'minimum' microsecond length based on the minimum pulse of 150
#define USMAX 3000 // This is the rounded 'maximum' microsecond length based on the maximum pulse of 600
#define SERVO_FREQ 50 // Analog servos run at ~50 Hz updates
// our servo # counter
uint8_t servonum = 0;
uint16_t degrees=0;
void setup() {
Serial.begin(9600);
Serial.println("8 channel Servo test!");
pwm.begin();
// In theory the internal oscillator is 25MHz but it really isn't
// that precise. You can 'calibrate' by tweaking this number till
// you get the frequency you're expecting!
//pwm.setOscillatorFrequency(27000000); // The int.osc. is closer to 27MHz
pwm.setPWMFreq(SERVO_FREQ); // Analog servos run at ~50 Hz updates
delay(10);
}
void angles(){
int angle=0;
int pulse=map(angle,0,180,150, 560);
pwm.setPWM(servonum,0,pulse);
delay(1000);
Serial.println(angle);
Serial.println(pulse);
angle=90;
pulse=map(angle,0,180,150, 560);
pwm.setPWM(servonum,0,pulse);
Serial.println(angle);
Serial.println(pulse);
delay(1000);
angle=180;
pulse=map(angle,0,180,150, 560);
pwm.setPWM(servonum,0,pulse);
Serial.println(angle);
Serial.println(pulse);
delay(1000);
}
void sweep(){
int pulse1=0;
for (pulse1=150; pulse1<=565; pulse1+=1){
pwm.setPWM(servonum,0,pulse1);
Serial.println(pulse1);
delay(20);
}
delay(2000);
pwm.setPWM(servonum,0,250);
delay(2000);
for (pulse1=550;pulse1>=150;pulse1-=1){
pwm.setPWM(servonum,0,pulse1);
Serial.println(pulse1);
delay(25);
}
delay(2000);
for (pulse1=150;pulse1<=550;pulse1+=1){
pwm.setPWM(servonum,0,pulse1);
Serial.println(pulse1);
delay(25);
}
pwm.setPWM(servonum,0,140);
delay(2000);
}
void loop() {
sweep();
angles();
Serial.println("TESTING");
my setup right now was a SG90 on slot1 and a MG90 slot 0 of the controller.
i started with the SG. Sweep was called, and it worked fine, sweeping in both directions.
after that the "angles()" where called and it moved to the 0, 90 and 180 position.
changed the "servonum" to 0 to get to the MG90.
sweep worked. but it did not move during the "angles" part.
as soon as the loop was back in the sweep it turned again.
and i dont know why its not moving.