Hi, I've got the Adafruit PCA9685 chip I'm trying to get to work with a combination of 4 LEDs as part of a larger project, I'm still trying to understand how the chip works. I used the guide here: Arduino PCA9685 example - Arduino Learning
I can set a PWM frequency of 1000 Hz. But when I try to set a duty cycle for the PWM, it seems all LEDs are affected by each other, I can't get them to individual values.
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>
// called this way, it uses the default address 0x40
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
void setup() {
Serial.begin(9600);
Serial.println("16 channel PWM test!");
pwm.begin();
pwm.setPWMFreq(1000); // This is the maximum PWM frequency
// save I2C bitrate
uint8_t twbrbackup = TWBR;
// must be changed after calling Wire.begin() (inside pwm.begin())
TWBR = 12; // upgrade to 400KHz!
}
void loop() {
pwm.setPWM(0, 0, 4096);
pwm.setPWM(1, 0, 1024);
pwm.setPWM(2, 0, 2048);
pwm.setPWM(3, 3072, 4096);
}
I have attached a picture of the connections. SDA, SDL, VCC and GND are connected to Arduino UNO. PWM pins of chip are connected to the LED's positive and their ground pins are connected to a common rail which is going to GND on one of the LEDs (I saw it wired this way).
Everything is copied from the example given in the link except the loop, which is meant to simply assign a different duty cycle to each LED yet they're all equally bright. Why is this?