Meadow.Foundation.Leds.Apa102
Apa102 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
Apa102 apa102;
readonly int numberOfLeds = 256;
readonly float maxBrightness = 0.25f;
public override Task Initialize()
{
Resolver.Log.Info("Initialize...");
apa102 = new Apa102(Device.CreateSpiBus(), numberOfLeds, Apa102.PixelOrder.BGR);
return base.Initialize();
}
public override Task Run()
{
apa102.Clear();
apa102.SetLed(index: 0, color: Color.Red, brightness: 0.5f);
apa102.SetLed(index: 1, color: Color.Purple, brightness: 0.6f);
apa102.SetLed(index: 2, color: Color.Blue, brightness: 0.7f);
apa102.SetLed(index: 3, color: Color.Green, brightness: 0.8f);
apa102.SetLed(index: 4, color: Color.Yellow, brightness: 0.9f);
apa102.SetLed(index: 5, color: Color.Orange, brightness: 1.0f);
apa102.Show();
Apa102Tests();
return Task.CompletedTask;
}
Sample project(s) available on GitHub
Wiring Example
To wire a Apa102 to your Meadow board, connect the following:
Apa102 | Meadow Pin |
---|---|
GND | GND |
CI | SCK |
DI | MOSI |
VCC | 5V |
It should look like the following diagram: