Meadow.Foundation.Leds.Ws2812
Ws2812 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
private Ws2812 neoPixels;
private readonly int ledCount = 24;
public override Task Initialize()
{
var spiBus = Device.CreateSpiBus();
neoPixels = new Ws2812(spiBus, ledCount);
return base.Initialize();
}
public override async Task Run()
{
while (true)
{
for (int i = 0; i < neoPixels.NumberOfLeds; i++)
{
neoPixels.SetAllLeds(Color.Black);
neoPixels.SetLed(i, Color.Blue);
neoPixels.Show();
await Task.Delay(100);
}
}
}