Simple test¶
Ensure your device works with this simple test.
examples/pca9685_simpletest.py¶
from machine import Pin, I2C
from micropython_pca9685 import PCA9685
i2c = I2C(1, sda=Pin(2), scl=Pin(3)) # Correct I2C pins for RP2040
pca = PCA9685(i2c)
pca.frequency = 60
# Set the PWM duty cycle for channel zero to 50%. duty_cycle is 16 bits to match other PWM objects
# but the PCA9685 will only actually give 12 bits of resolution.
pca.channels[0].duty_cycle = 0x7FFF