Hey, Im trying to make something with the 16ch PWM Driver - Adafruit 16-Channel 12-bit PWM/Servo Driver - I2C interface [PCA9685] : ID 815 : $14.95 : Adafruit Industries, Unique & fun DIY electronics and kits
Im testing some patterns with 16 leds, for figure out how this driver and library works.
I wrote this below for dimming 16ch leds in the same time, and it works fine but one thing.
It blinks one time at the peak brightness before it starts to dimm out.
Can somebody help me for this?
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>
Adafruit_PWMServoDriver pwm1 = Adafruit_PWMServoDriver(0x40);
void setup() {
Serial.begin(9600);
pwm1.begin();
pwm1.setPWMFreq(1600);
Wire.setClock(400000);
for(uint16_t pin=0; pin<16; pin++){ //turn off the all leds
pwm1.setPWM(pin, 0, 0);
}
}
void loop(){
for(uint16_t n=0; n<=4096; n += 16){ //turn on the leds
for(uint16_t pin=0; pin<16; pin ++){
pwm1.setPWM(pin, 0, n);
}
}
for(uint16_t f=0; f<=4096; f += 16){ //turn off the leds
for(uint16_t pin=0; pin<16; pin ++){
pwm1.setPWM(pin, f, 0);
}
}
}