Skip to content

CCSWE-nanoFramework/CCSWE.nanoFramework.NeoPixel

Repository files navigation

Build License NuGet

CCSWE.nanoFramework.NeoPixel

A fast ESP32 RMT library for controlling LED chipsets (NeoPixel, WS2812B, etc.)

I was originally using the Ws28xx.Esp32 but it was taking 600-700ms to update a strip of 50 LEDs. This was not fast enough for my use case so I set out to find a faster solution.

The NeoPixelStripLowMemory sample code was much faster at 50-60ms to update the same strip so that's where I started. I've also been looking at the FastLED library as I've used that in the past and it is indeed fast.

I've never spent time learning how these LEDs actually work so I'm learning as I go along and would love feedback or contributions from others with more experience in this area.

Usage

See samples for more details.

Initialize the strip

// Configure the number of LEDs
ushort count = 47;

// Adjust the pin number
byte pin = 19;

// Choose the correct driver and color order
var driver = new Ws2812B(ColorOrder.GRB);

// Create the strip
var strip = new NeoPixelStrip(pin, count, driver);

Set the LEDs

// Set all LEDs
strip.Fill(Color.Pink);

for (var i = 0; i < strip.Count; i++)
{
    if (i % 2 == 0)
    {
        // Set an individual LED
        strip.SetLed(i, Color.Blue);
    }
}

// Send the data to update the strip
strip.Update();

Brightness scaling

Both the Fill and SetPixel methods have overloads that allow you to pass a brightness scaling factor. If you will be using the same color for multiple calls then it is more efficient to call ColorConverter.ScaleBrightness(Color, double) directly and use the pre-scaled Color across multiple calls.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages