MicroPython EvoPWMDriver#

class EvoPWMDriver.EvoPWMDriver(channel, i2c=I2CA, address=0x40, freq=100)#

Frozen Python PCA9685 PWM driver. Constructor returns a driver object for the selected I2C multiplexer channel.

EvoPWMDriver.begin()#

Initialise the PCA9685 and apply the configured frequency. Returns None.

EvoPWMDriver.reset()#

Reset the PCA9685 mode registers. Returns None.

EvoPWMDriver.sleep()#
EvoPWMDriver.wake()#

Put the PCA9685 to sleep or wake it again. Returns None.

EvoPWMDriver.isSleeping()#

Return True if the PCA9685 sleep bit is set, otherwise False.

EvoPWMDriver.getAddress()#

Return the I2C address used by the driver.

EvoPWMDriver.setPWMFreq(freq)#

Set the output PWM frequency in hertz. Returns None.

EvoPWMDriver.getPWMFreq()#

Return the configured PWM frequency in hertz.

EvoPWMDriver.setChannelPulseRange(pwm_channel, min_us, max_us)#

Set servo pulse limits for one channel in microseconds. Returns None.

EvoPWMDriver.getChannelPulseRange(pwm_channel)#

Return (min_us, max_us) for the channel.

EvoPWMDriver.setChannelAngleRange(pwm_channel, min_angle, max_angle)#

Set angle limits for one channel. Returns None.

EvoPWMDriver.getChannelAngleRange(pwm_channel)#

Return (min_angle, max_angle) for the channel.

EvoPWMDriver.setPWM(pwm_channel, on, off)#

Set raw PCA9685 on and off counts for a channel. Returns None.

EvoPWMDriver.getPWM(pwm_channel)#

Return (on, off) raw counts for a channel.

EvoPWMDriver.setDuty(pwm_channel, duty)#

Set a duty ratio for a channel. Returns None.

EvoPWMDriver.getDuty(pwm_channel)#

Return the channel duty ratio as a float.

EvoPWMDriver.setPulse(pwm_channel, pulse_us)#

Set a high pulse width in microseconds. Returns None.

EvoPWMDriver.getPulse(pwm_channel)#

Return the current pulse width in microseconds.

EvoPWMDriver.setAngle(pwm_channel, angle)#

Map angle through the channel angle and pulse ranges and write the resulting PWM pulse. Returns None.

EvoPWMDriver.stop(pwm_channel)#
EvoPWMDriver.off(pwm_channel)#

Turn a channel fully off. Returns None.

EvoPWMDriver.allOff()#

Turn all channels off. Returns None.

EvoPWMDriver.allOn()#

Turn all channels fully on. Returns None.

Constants

CH0 through CH15 identify PCA9685 channels.