Remarks
Pca9633 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
Pca9633 pca9633;
public override Task Initialize()
{
Console.WriteLine("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) |
Characteristic | Locus |
---|---|
Inheritance | System.Object > Pca9633 |
Namespace | Meadow.Foundation.Leds |
Assembly | Pca9633.dll |
Syntax
public class Pca9633 : object
Constructors
Pca9633(II2cBus, Pca9633.Addresses)
Create a new Pca9633 led controller object
Declaration
public Pca9633(II2cBus i2cBus, Pca9633.Addresses address)
Parameters
Type | Name | Description |
---|---|---|
II2cBus | i2cBus | i2c bus |
Pca9633.Addresses | address | i2c address |
Pca9633(II2cBus, Byte)
Create a new Pca9633 led controller object
Declaration
public Pca9633(II2cBus i2cBus, byte address = null)
Parameters
Type | Name | Description |
---|---|---|
II2cBus | i2cBus | i2c bus |
System.Byte | address | i2c address |
Properties
IsOn
Turn led controller output on or off
Declaration
public bool IsOn { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
LedBlue
Red LED location - used for RGB control
Declaration
public Pca9633.LedPosition LedBlue { get; set; }
Property Value
Type | Description |
---|---|
Pca9633.LedPosition |
LedGreen
Red LED location - used for RGB control
Declaration
public Pca9633.LedPosition LedGreen { get; set; }
Property Value
Type | Description |
---|---|
Pca9633.LedPosition |
LedRed
Red LED location - used for RGB control
Declaration
public Pca9633.LedPosition LedRed { get; set; }
Property Value
Type | Description |
---|---|
Pca9633.LedPosition |
Methods
SetAutoIncrementMode(Pca9633.AutoIncrement)
Set auto increment mode of control registers
Declaration
public void SetAutoIncrementMode(Pca9633.AutoIncrement mode)
Parameters
Type | Name | Description |
---|---|---|
Pca9633.AutoIncrement | mode |
SetColor(Color)
Set RGB LED color if red, green and blue LEDs are set
Declaration
public void SetColor(Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color | Color |
SetDriveMode(Pca9633.DriveType)
Set the drive mode Open drain or totem pole
Declaration
public void SetDriveMode(Pca9633.DriveType drive)
Parameters
Type | Name | Description |
---|---|---|
Pca9633.DriveType | drive |
SetGroupBrightess(Byte)
Set brightness of all leds
Declaration
public void SetGroupBrightess(byte brightness)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | brightness | brightness (0-255) |
SetLedBrightness(Pca9633.LedPosition, Byte)
Set brightness of an individual led
Declaration
public void SetLedBrightness(Pca9633.LedPosition led, byte brightness)
Parameters
Type | Name | Description |
---|---|---|
Pca9633.LedPosition | led | led position |
System.Byte | brightness | brightness (0-255) |
SetRgbLedPositions(Pca9633.LedPosition, Pca9633.LedPosition, Pca9633.LedPosition)
Helper method to set RGB led positions for color control
Declaration
public void SetRgbLedPositions(Pca9633.LedPosition redLed, Pca9633.LedPosition greenLed, Pca9633.LedPosition blueLed)
Parameters
Type | Name | Description |
---|---|---|
Pca9633.LedPosition | redLed | red led position |
Pca9633.LedPosition | greenLed | green led position |
Pca9633.LedPosition | blueLed | blue led position |
Sleep()
Put device into sleep state
Declaration
public void Sleep()
Wake()
Put device into active state
Declaration
public void Wake()