Meadow.Foundation.Leds.Pca9633
Pca9633 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
Pca9633 pca9633;
public override Task Initialize()
{
Resolver.Log.Info("Initialize...");
pca9633 = new Pca9633(Device.CreateI2cBus());
return base.Initialize();
}
public override Task Run()
{
//set the location of R,G,B leds for color control
pca9633.SetRgbLedPositions(redLed: Pca9633.LedPosition.Led2,
greenLed: Pca9633.LedPosition.Led1,
blueLed: Pca9633.LedPosition.Led0);
//set a single color
pca9633.SetColor(Color.Red);
Thread.Sleep(1000);
pca9633.SetColor(Color.Blue);
Thread.Sleep(1000);
pca9633.SetColor(Color.Yellow);
return base.Run();
}
Sample project(s) available on GitHub
Wiring Example
To wire a Pca9633 to your Meadow board, connect the following:
Pca9633 | Meadow Pin |
---|---|
GND | GND |
VCC | 3V3 |
SCL | D08 (SCL Pin) |
SDA | D07 (SDA Pin) |
Class Pca9633
Represents a Pca9633 led driver
Assembly: Pca9633.dll
View Source
Declaration
public class Pca9633 : II2cPeripheral
Implements:
Meadow.Hardware.II2cPeripheral
Properties
DefaultI2cAddress
The default I2C address for the peripheral
View Source
Declaration
public byte DefaultI2cAddress { get; }
LedRed
Red LED location - used for RGB control
View Source
Declaration
public Pca9633.LedPosition LedRed { get; set; }
LedGreen
Red LED location - used for RGB control
View Source
Declaration
public Pca9633.LedPosition LedGreen { get; set; }
LedBlue
Red LED location - used for RGB control
View Source
Declaration
public Pca9633.LedPosition LedBlue { get; set; }
IsOn
Turn led controller output on or off
View Source
Declaration
public bool IsOn { get; set; }
Fields
i2cComms
I2C Communication bus used to communicate with the peripheral
View Source
Declaration
protected readonly II2cCommunications i2cComms
Methods
Wake()
Put device into active state
View Source
Declaration
public void Wake()
Sleep()
Put device into sleep state
View Source
Declaration
public void Sleep()
SetRgbLedPositions(LedPosition, LedPosition, LedPosition)
Helper method to set RGB led positions for color control
View Source
Declaration
public void SetRgbLedPositions(Pca9633.LedPosition redLed, Pca9633.LedPosition greenLed, Pca9633.LedPosition blueLed)
Parameters
Type | Name | Description |
---|---|---|
Meadow.Foundation.Leds.Pca9633.LedPosition | redLed | red led position |
Meadow.Foundation.Leds.Pca9633.LedPosition | greenLed | green led position |
Meadow.Foundation.Leds.Pca9633.LedPosition | blueLed | blue led position |
SetColor(Color)
Set RGB LED color if red, green and blue LEDs are set
View Source
Declaration
public void SetColor(Color color)
Parameters
Type | Name | Description |
---|---|---|
Meadow.Color | color | Color |
SetLedBrightness(LedPosition, byte)
Set brightness of an individual led
View Source
Declaration
public void SetLedBrightness(Pca9633.LedPosition led, byte brightness)
Parameters
Type | Name | Description |
---|---|---|
Meadow.Foundation.Leds.Pca9633.LedPosition | led | led position |
System.Byte | brightness | brightness (0-255) |
SetGroupBrightess(byte)
Set brightness of all leds
View Source
Declaration
public void SetGroupBrightess(byte brightness)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | brightness | brightness (0-255) |
SetDriveMode(DriveType)
Set the drive mode Open drain or totem pole
View Source
Declaration
public void SetDriveMode(Pca9633.DriveType drive)
Parameters
Type | Name |
---|---|
Meadow.Foundation.Leds.Pca9633.DriveType | drive |
SetAutoIncrementMode(AutoIncrement)
Set auto increment mode of control registers
View Source
Declaration
public void SetAutoIncrementMode(Pca9633.AutoIncrement mode)
Parameters
Type | Name |
---|---|
Meadow.Foundation.Leds.Pca9633.AutoIncrement | mode |
Implements
Meadow.Hardware.II2cPeripheral