PCA9685 issues when using addresses.

I’m having a bit of a strange issue with the PCA9685 boards. When I only want to use one it works fine but when i want to use more than one it will not work at all.

I have narrowed it down to the addressing. when I use

Adafruit_PWMServoDriver pwm1 = Adafruit_PWMServoDriver();

It works fine. no issue but when i use

Adafruit_PWMServoDriver pwm1 = Adafruit_PWMServoDriver(0x40);
Adafruit_PWMServoDriver pwm2 = Adafruit_PWMServoDriver(0x41);

It will not work at all.

Here is my code that I am trying to run. Any help is appreciated (also I should add that I do have the address pins soldered correctly. )

#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>

Adafruit_PWMServoDriver pwm1 = Adafruit_PWMServoDriver(0x40);
Adafruit_PWMServoDriver pwm2 = Adafruit_PWMServoDriver(0x41);

#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)

uint8_t servonum = 0;

void setup() {
Serial.begin(9600);
Serial.println(“Serial begin”);

pwm1.begin();
Serial.println(“pwm 1 begin”);
pwm1.setPWMFreq(60); // Analog servos run at ~60 Hz updates
Serial.println(“pwm 1 set freq”);
pwm2.begin();
Serial.println(“pwm 2 begin”);
pwm2.setPWMFreq(60); // Analog servos run at ~60 Hz updates
Serial.println(“pwm 2 set freq”);

delay(10);
}

// you can use this function if you’d like to set the pulse length in seconds
// e.g. setServoPulse(0, 0.001) is a ~1 millisecond pulse width. its not precise!
void setServoPulse(uint8_t n, double pulse) {
double pulselength;

pulselength = 1000000; // 1,000,000 us per second
pulselength /= 60; // 60 Hz
// Serial.print(pulselength); Serial.println(" us per period");
pulselength /= 4096; // 12 bits of resolution
//Serial.print(pulselength); Serial.println(" us per bit");
pulse *= 1000000; // convert to us
pulse /= pulselength;
//Serial.println(pulse);
Serial.println (n);
if (n >= 0 && n <=15){
pwm1.setPWM(n, 0, pulse);
}
else if (n >= 16 && n <= 31){
n = n-16;
pwm2.setPWM(n, 0, pulse);
}
}

void loop() {
setServoPulse(1,0.001);
delay(500);
Serial.println(“servo 1 moved”);
setServoPulse(0,0.001);
delay(500);
Serial.println(“servo 0 moved”);
setServoPulse(1,0.0015);
delay(500);
Serial.println(“servo 1 moved”);
setServoPulse(0,0.0015);
delay(500);
Serial.println(“servo 0 moved”);

setServoPulse(17,0.001);
delay(500);
Serial.println(“servo 17 moved”);
setServoPulse(18,0.001);
delay(500);
Serial.println(“servo 18 moved”);
setServoPulse(17,0.0015);
delay(500);
Serial.println(“servo 17 moved”);
setServoPulse(18,0.0015);
delay(500);
Serial.println(“servo 18 moved”);
}

It works fine. no issue but when i use

Do you only change the software or also the hardware? Try the first version with both devices connected. Does that work?
Does the second version work if only one device is connected?

If it doesn't work, what exact output do you get?

Please edit your post and replace the quote tags by code tags!