Skip to main content

Meadow.Foundation.Leds.Ws2812

Ws2812
StatusStatus badge: working
Source codeGitHub
Datasheet(s)GitHub
NuGet packageNuGet Gallery for Meadow.Foundation.Leds.Ws2812

Class Ws2812

Represents WS2812/Neopixel Led(s)

Assembly: Ws2812.dll
View Source
Declaration
public class Ws2812 : ISpiPeripheral, IDisposable

Implements:
Meadow.Hardware.ISpiPeripheral, System.IDisposable

Properties

DefaultSpiBusSpeed

The default SPI bus speed for the device

View Source
Declaration
public Frequency DefaultSpiBusSpeed { get; }

SpiBusSpeed

The SPI bus speed for the device

View Source
Declaration
public Frequency SpiBusSpeed { get; set; }

DefaultSpiBusMode

The default SPI bus mode for the device

View Source
Declaration
public SpiClockConfiguration.Mode DefaultSpiBusMode { get; }

SpiBusMode

The SPI bus mode for the device

View Source
Declaration
public SpiClockConfiguration.Mode SpiBusMode { get; set; }

NumberOfLeds

Total number of leds

View Source
Declaration
public int NumberOfLeds { get; }

IsDisposed

Is the object disposed

View Source
Declaration
public bool IsDisposed { get; }

Fields

spiComms

SPI Communication bus used to communicate with the peripheral

View Source
Declaration
protected ISpiCommunications spiComms

Methods

SetLed(int, Color)

Set the color of the specified LED

View Source
Declaration
public void SetLed(int index, Color color)
Parameters
TypeNameDescription
System.Int32indexIndex of the LED to change
Meadow.ColorcolorThe color

SetLed(int, byte[])

Set the color of the specified LED

View Source
Declaration
public void SetLed(int index, byte[] rgb)
Parameters
TypeNameDescription
System.Int32indexIndex of the LED to change
System.Byte[]rgbByte array representing the color RGB values. byte[0] = Red, byte[1] = Green, byte[2] = Blue

Show()

Transmit the buffer to the LEDs

View Source
Declaration
public void Show()

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

View Source
Declaration
public void Dispose()

Dispose(bool)

Dispose of the object

View Source
Declaration
protected virtual void Dispose(bool disposing)
Parameters
TypeNameDescription
System.BooleandisposingIs disposing

Implements

  • Meadow.Hardware.ISpiPeripheral
  • System.IDisposable