I am using the PCA9865 to light a led

My circuit enter image description here

Arduino to PCA9865 A5 > SLC A4 > SDA 5V > 5V GND > GND and 5 volts from a battery

enter image description here

My code:

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

// called this way, it uses the default address 0x40
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();

void setup()
  pwm.setPWMFreq(60);  //~60 Hz updates

void loop()
  int pin = 0;
  pwm.setPWM(pin, 4096, 0);

the led does not light

  • add a current limiting resistor in series with the LED. could you light the LED with Uno directly? set higher freequency
    – Juraj
    May 1, 2020 at 4:25
  • really? you wired it to 4 and 5 instead of A4 and A5?
    – Juraj
    May 3, 2020 at 12:40

1 Answer 1


As written in the comments check resistor/led AND make sure you get power/GND to the terminal on the PCA board as this is needed for powering servos/leds/motors hanging on the board. I use about 10 on my layout and they are fantastic for powering all kind of appliancies. I patched the lib but in your case this is overkill. Instead of

void setPWM(uint8_t num, uint16_t on, uint16_t off);

you could also try

void setPin(uint8_t num, uint16_t val, bool invert=false);

but that is not the problem here
Thanks for the foto now its clear why not. You have to connect A4 (UNO SCA) - SCA (PCA9865) AND A5 (UNO SCL) - SCL (PCA9865) see diagram:

UNO to PCA9865

  • I added a photo of my circuit
    – Diego
    May 1, 2020 at 20:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.