Datasheet
Usage
The following section will show how to control the PCA9685 from the board's Python prompt / REPL. You'll learn how
to interactively control servos and dim LEDs by typing in the code below.
First connect to the board's serial REPL so you are at the CircuitPython >>> prompt.
I2C Initialization
First you'll need to initialize the I2C bus for your board. First import the necessary modules:
Now for either board run this command to create the I2C instance using the default SCL and SDA pins (which will be
marked on the boards pins if using a Feather or similar Adafruit board):
After initializing the I2C interface you need to import the PCA9685 module to use it in your own code:
Dimming LED's
Each channel of the PCA9685 can be used to control the brightness of an LED. The PCA9685 generates a high-speed
PWM signal which turns the LED on and off very quickly. If the LED is turned on longer than turned off it will appear
brighter to your eyes.
First wire a LED to the board as follows. Note you don't need to use a resistor to limit current through the LED as the
PCA9685 will limit the current to around 10mA:
import board
import busio
i2c = busio.I2C(board.SCL, board.SDA)
import adafruit_pca9685
© Adafruit Industries https://learn.adafruit.com/16-channel-pwm-servo-driver Page 22 of 29










