Module PCA9685 :: Class PWM
[hide private]
[frames] | no frames]

Class PWM

source code

Instance Methods [hide private]
 
__init__(self, bus, address=64)
Creates an instance of the PWM chip at given i2c address.
source code
 
setFreq(self, freq)
Sets the PWM frequency.
source code
 
setDuty(self, channel, duty)
Sets a single PWM channel.
source code
 
_writeByte(self, reg, value) source code
 
_readByte(self, reg) source code
Class Variables [hide private]
  _mode_adr = 0
  _base_adr_low = 8
  _base_adr_high = 9
  _prescale_adr = 254
Method Details [hide private]

__init__(self, bus, address=64)
(Constructor)

source code 

Creates an instance of the PWM chip at given i2c address.

Parameters:
  • bus - the SMBus instance to access the i2c port (0 or 1).
  • address - the address of the i2c chip (default: 0x40)

setFreq(self, freq)

source code 

Sets the PWM frequency. The value is stored in the device.

Parameters:
  • freq - the frequency in Hz (approx. in range 16 - 1500 Hz)

setDuty(self, channel, duty)

source code 

Sets a single PWM channel. The value is stored in the device.

Parameters:
  • channel - one of the channels 0..15
  • duty - the duty cycle 0..4095 (included)