Class Pca9685
Represents a PCA9685
Assembly: Pca9685.dll
View Source
Declaration
public class Pca9685 : II2cPeripheral, IDigitalOutputController, IPwmOutputController, IPinController, IDisposable
Implements:
Meadow.Hardware.II2cPeripheral
, Meadow.Hardware.IDigitalOutputController
, Meadow.Hardware.IPwmOutputController
, Meadow.Hardware.IPinController
, System.IDisposable
Properties
DefaultI2cAddress
The default I2C address for the peripheral
View Source
Declaration
public byte DefaultI2cAddress { get; }
i2cBus
The I2C bus connected to the pca9685
View Source
Declaration
protected II2cBus i2cBus { get; set; }
Pins
PCA9685 pin definitions
View Source
Declaration
public Pca9685.PinDefinitions Pins { get; }
Frequency
The frequency for the PWM outputs
View Source
Declaration
public Frequency Frequency { get; }
Fields
i2cComms
I2C Communication bus used to communicate with the peripheral
View Source
Declaration
protected readonly II2cCommunications i2cComms
Methods
CreateDigitalOutputPort(IPin, bool, OutputType)
Creates an IDigitalOutputPort on the specified pin.
View Source
Declaration
public IDigitalOutputPort CreateDigitalOutputPort(IPin pin, bool initialState = false, OutputType initialOutputType = OutputType.PushPull)
Returns
Meadow.Hardware.IDigitalOutputPort
Parameters
Type | Name | Description |
---|---|---|
Meadow.Hardware.IPin | pin | The pin on which to create the port. |
System.Boolean | initialState | The default initial state of the port, |
either LOW (false ), or HIGH (true ). | ||
Meadow.Hardware.OutputType | initialOutputType | Whether the port is initially configured |
as PushPull or OpenDrain. PushPull by default. |
CreatePwmPort(IPin, float, bool)
View Source
Declaration
public IPwmPort CreatePwmPort(IPin pin, float dutyCycle = 0.5, bool invert = false)
Returns
Meadow.Hardware.IPwmPort
Parameters
Type | Name |
---|---|
Meadow.Hardware.IPin | pin |
System.Single | dutyCycle |
System.Boolean | invert |
CreatePwmPort(IPin, Frequency, float, bool)
Creates an IPwmPort on the specified pin.
View Source
Declaration
public IPwmPort CreatePwmPort(IPin pin, Frequency frequency, float dutyCycle = 0.5, bool invert = false)
Returns
Meadow.Hardware.IPwmPort
: The created PWM port.
Parameters
Type | Name | Description |
---|---|---|
Meadow.Hardware.IPin | pin | The pin on which to create the PWM port. |
Meadow.Units.Frequency | frequency | The desired frequency of the PWM signal. |
System.Single | dutyCycle | The desired duty cycle of the PWM signal. Defaults to Meadow.Hardware.IPwmOutputController.DefaultPwmDutyCycle . |
System.Boolean | invert | Specifies whether the PWM signal should be inverted. Defaults to false. |
Dispose(bool)
View Source
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name |
---|---|
System.Boolean | disposing |
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
View Source
Declaration
public void Dispose()
Implements
Meadow.Hardware.II2cPeripheral
Meadow.Hardware.IDigitalOutputController
Meadow.Hardware.IPwmOutputController
Meadow.Hardware.IPinController
System.IDisposable