Driver for the PCA9685 PWM control IC. Its commonly used to control servos, leds and motors.
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
- 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
PCA9685(i2c_bus, *, address=64, reference_clock_speed=25000000)¶
Initialise the PCA9685 chip at
The internal reference clock is 25mhz but may vary slightly with environmental conditions and manufacturing variances. Providing a more precise
reference_clock_speedcan improve the accuracy of the frequency and duty_cycle computations. See the
calibration.pyexample for how to derive this value by measuring the resulting pulse widths.
Stop using the pca9685.
The overall PWM frequency in Hertz.
The reference clock speed in Hz.
Reset the chip.
Lazily creates and caches channel objects as needed. Treat it like a sequence.
A single PCA9685 channel that matches the
16 bit value that dictates how much of one cycle is high (1) versus low (0). 0xffff will always be high, 0 will always be low and 0x7fff will be half high and then half low.
The overall PWM frequency in Hertz (read-only). A PWMChannel’s frequency cannot be set individually. All channels share a common frequency, set by PCA9685.frequency.