adafruit_pca9685
Driver for the PCA9685 PWM control IC. Its commonly used to control servos, leds and motors.
See also
The Adafruit CircuitPython Motor library can be used to control the PWM outputs for specific uses instead of generic duty_cycle adjustments.
Author(s): Scott Shawcroft
Implementation Notes
Hardware:
Adafruit 16-Channel 12-bit PWM/Servo Driver - I2C interface - PCA9685 (Product ID: 815)
Software and Dependencies:
Adafruit CircuitPython firmware for the ESP8622 and M0-based boards: https://github.com/adafruit/circuitpython/releases
Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
Adafruit’s Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
- class adafruit_pca9685.PCA9685(i2c_bus: I2C, *, address: int = 64, reference_clock_speed: int = 25000000)[source]
Initialise the PCA9685 chip at
address
oni2c_bus
.The internal reference clock is 25mhz but may vary slightly with environmental conditions and manufacturing variances. Providing a more precise
reference_clock_speed
can improve the accuracy of the frequency and duty_cycle computations. See thecalibration.py
example for how to derive this value by measuring the resulting pulse widths.- Parameters:
- channels
Sequence of 16
PWMChannel
objects. One for each channel.
- reference_clock_speed
The reference clock speed in Hz.
- class adafruit_pca9685.PCAChannels(pca: PCA9685)[source]
Lazily creates and caches channel objects as needed. Treat it like a sequence.
- Parameters:
pca (PCA9685) – The PCA9685 object
- class adafruit_pca9685.PWMChannel(pca: PCA9685, index: int)[source]
A single PCA9685 channel that matches the
PWMOut
API.