nanoFramework.Iot.Device.Ws28xx.Esp32 1.2.673

Prefix Reserved
dotnet add package nanoFramework.Iot.Device.Ws28xx.Esp32 --version 1.2.673                
NuGet\Install-Package nanoFramework.Iot.Device.Ws28xx.Esp32 -Version 1.2.673                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="nanoFramework.Iot.Device.Ws28xx.Esp32" Version="1.2.673" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add nanoFramework.Iot.Device.Ws28xx.Esp32 --version 1.2.673                
#r "nuget: nanoFramework.Iot.Device.Ws28xx.Esp32, 1.2.673"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install nanoFramework.Iot.Device.Ws28xx.Esp32 as a Cake Addin
#addin nuget:?package=nanoFramework.Iot.Device.Ws28xx.Esp32&version=1.2.673

// Install nanoFramework.Iot.Device.Ws28xx.Esp32 as a Cake Tool
#tool nuget:?package=nanoFramework.Iot.Device.Ws28xx.Esp32&version=1.2.673                

Ws28xx/WS2812B/WS2815B/WS2808/SK6812/Neo pixel for ESP32 using RMT - LED drivers

This binding allows you to update the RGB LEDs on Ws28xx, SK6812 and based strips and matrices.

To see how to use the binding in code, see the sample.

Important: This implementation is for ESP32 boards only. Do not use with other boards. USe the SPI implementation instead.

Documentation

Board

WS2812B

image

Usage

using Iot.Device.Ws28xx.Esp32;
using System.Diagnostics;
using System.Drawing;

// Configure the count of pixels
const int Count = 10;
// Adjust the pin number
const int Pin = 15;

// Use Ws2812 or SK6812 instead if needed
Ws28xx neo = new Ws2808(Pin, Count);
Rainbow(neo, Count);

void Rainbow(Ws28xx neo, int count, int iterations = 1)
{
    BitmapImage img = neo.Image;
    for (var i = 0; i < 255 * iterations; i++)
    {
        for (var j = 0; j < count; j++)
        {            
            img.SetPixel(j, 0, Wheel((i + j) & 255));
        }

        neo.Update();
    }
}

Using BitmapImage

The BitmapImage gives you the opportunity to work on rectangular matrix. For example is you are using a M5Stack Atom Matrix, you'll be able to use a 5 x 5 matrix. In this case, you'll be able to set a specific pixel with coordinates using the SetPixel function.

Also nothing is display before the Update function is called.

Advance usage

The Ws28xx class provide a generic driver. In case your strip is not supported or colors are inverted or coded in a different number of colors, you can use specific definitions and create your own class. Here is the example for the SK6812 used in the M5Stack Fire for example:

public Sk6812(int gpioPin, int width, int height = 1)
    : base(gpioPin, new BitmapImageWs2808Grb(width, height))
{
    ClockDivider = 4;
    OnePulse = new(14, true, 12, false);
    ZeroPulse = new(7, true, 16, false);
    ResetCommand = new(500, false, 520, false);
}

The various BitmapImage*** classes already take into account the color schemes, the bit per color coding. Use one of them to accommodate your needs.

The pulses are calculated based on the datasheet of each driver. A OnePulse is a pulse coding for a bit high = 1. A ZeroPulse is coding for a bit low = 0. And a ResetCommand is the command used in some drivers at the end of the pulse chain.

Each pulse is 80MHz based and then divided by the ClockDivider. You have to take this into account to make the proper math for the pulses.

Limitations

If you are using a very very long chain, depending on your board and the memory available on it, you can be out of memory while preparing the pulse chain to send.

Product Compatible and additional computed target framework versions.
.NET Framework net is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on nanoFramework.Iot.Device.Ws28xx.Esp32:

Package Downloads
nanoFramework.AtomLite

This package includes the nanoFramework.AtomLite assembly for .NET nanoFramework C# projects.

nanoFramework.AtomMatrix

This package includes the nanoFramework.AtomMatrix assembly for .NET nanoFramework C# projects.

nanoFramework.Fire

This package includes the nanoFramework.Fire assembly for .NET nanoFramework C# projects.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on nanoFramework.Iot.Device.Ws28xx.Esp32:

Repository Stars
nanoframework/Samples
🍬 Code samples from the nanoFramework team used in testing, proof of concepts and other explorational endeavours
Version Downloads Last updated
1.2.673 376 10/23/2024
1.2.665 209 10/16/2024
1.2.651 616 9/27/2024
1.2.631 575 8/28/2024
1.2.595 483 7/24/2024
1.2.580 658 6/28/2024
1.2.570 292 6/14/2024
1.2.548 466 5/15/2024
1.2.476 1,517 1/25/2024
1.2.436 1,041 11/10/2023
1.2.329 2,804 5/26/2023
1.2.316 993 5/16/2023
1.2.313 643 5/12/2023
1.2.308 902 5/11/2023
1.2.304 718 5/10/2023
1.2.297 895 5/3/2023
1.2.239 4,713 2/13/2023
1.2.212 3,199 1/5/2023
1.2.203 1,351 12/28/2022
1.2.159 1,499 11/14/2022
1.2.153 2,863 11/5/2022
1.2.141 3,751 10/25/2022
1.2.114 2,522 10/8/2022
1.2.92 5,538 9/20/2022
1.2.87 2,606 9/15/2022
1.2.82 946 9/14/2022
1.1.118.19693 21,917 6/24/2022
1.1.116.8772 1,775 6/24/2022
1.1.58.10097 14,406 5/23/2022
1.1.51.31918 2,640 5/20/2022
1.1.7 12,260 4/18/2022
1.1.1 4,360 4/14/2022
1.0.300 3,682 4/1/2022
1.0.1-preview.1 158 3/28/2022