Skip to main content

Class Ws2812

Represents WS2812/Neopixel Led(s)

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

Implements:
Meadow.Hardware.ISpiPeripheral, System.IDisposable

Properties

DefaultSpiBusSpeed

The default SPI bus speed for the device

View Source
public Frequency DefaultSpiBusSpeed { get; }

SpiBusSpeed

The SPI bus speed for the device

View Source
public Frequency SpiBusSpeed { get; set; }

DefaultSpiBusMode

The default SPI bus mode for the device

View Source
public SpiClockConfiguration.Mode DefaultSpiBusMode { get; }

SpiBusMode

The SPI bus mode for the device

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

NumberOfLeds

Total number of leds

View Source
public int NumberOfLeds { get; }

IsDisposed

Is the object disposed

View Source
public bool IsDisposed { get; }

Fields

spiComms

SPI Communication bus used to communicate with the peripheral

View Source
protected ISpiCommunications spiComms

Methods

SetLed(int, Color)

Set the color of the specified LED

View Source
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
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
public void Show()

Dispose()

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

View Source
public void Dispose()

Dispose(bool)

Dispose of the object

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

Implements

  • Meadow.Hardware.ISpiPeripheral
  • System.IDisposable