Remarks

Ws2812
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Leds.Ws2812
Characteristic Locus
Inheritance object > Ws2812
Implements ISpiPeripheral IDisposable
Inherited Members object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString()
Namespace Meadow.Foundation.Leds
Assembly Ws2812.dll

Syntax

public class Ws2812 : ISpiPeripheral, IDisposable

Constructors

Ws2812(ISpiBus, IPin, int)

Creates a new WS2812 object

Declaration
public Ws2812(ISpiBus spiBus, IPin chipSelectPin, int numberOfLeds)

Parameters

Type Name Description
ISpiBus spiBus

SPI bus

IPin chipSelectPin

Chip select pin

int numberOfLeds

Number of leds

Remarks

Ws2812
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Leds.Ws2812

Ws2812(ISpiBus, int, IDigitalOutputPort?)

Creates a new WS2812 object

Declaration
public Ws2812(ISpiBus spiBus, int numberOfLeds, IDigitalOutputPort? chipSelectPort = null)

Parameters

Type Name Description
ISpiBus spiBus

SPI bus

int numberOfLeds

Number of leds

IDigitalOutputPort chipSelectPort

SPI chip select port (optional)

Remarks

Ws2812
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Leds.Ws2812

Fields

spiComms

SPI Communication bus used to communicate with the peripheral

Declaration
protected ISpiCommunications spiComms

Field Value

Type Description
ISpiCommunications

Remarks

Ws2812
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Leds.Ws2812

Properties

DefaultSpiBusMode

The default SPI bus mode for the device

Declaration
public SpiClockConfiguration.Mode DefaultSpiBusMode { get; }

Property Value

Type Description
SpiClockConfiguration.Mode

Remarks

Ws2812
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Leds.Ws2812

DefaultSpiBusSpeed

The default SPI bus speed for the device

Declaration
public Frequency DefaultSpiBusSpeed { get; }

Property Value

Type Description
Frequency

Remarks

Ws2812
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Leds.Ws2812

IsDisposed

Is the object disposed

Declaration
public bool IsDisposed { get; }

Property Value

Type Description
bool

Remarks

Ws2812
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Leds.Ws2812

NumberOfLeds

Total number of leds

Declaration
public int NumberOfLeds { get; }

Property Value

Type Description
int

Remarks

Ws2812
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Leds.Ws2812

SpiBusMode

The SPI bus mode for the device

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

Property Value

Type Description
SpiClockConfiguration.Mode

Remarks

Ws2812
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Leds.Ws2812

SpiBusSpeed

The SPI bus speed for the device

Declaration
public Frequency SpiBusSpeed { get; set; }

Property Value

Type Description
Frequency

Remarks

Ws2812
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Leds.Ws2812

Methods

Dispose()

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

Declaration
public void Dispose()

Remarks

Ws2812
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Leds.Ws2812

Dispose(bool)

Dispose of the object

Declaration
protected virtual void Dispose(bool disposing)

Parameters

Type Name Description
bool disposing

Is disposing

Remarks

Ws2812
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Leds.Ws2812

SetLed(int, Color)

Set the color of the specified LED

Declaration
public void SetLed(int index, Color color)

Parameters

Type Name Description
int index

Index of the LED to change

Color color

The color

Remarks

Ws2812
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Leds.Ws2812

SetLed(int, byte[])

Set the color of the specified LED

Declaration
public void SetLed(int index, byte[] rgb)

Parameters

Type Name Description
int index

Index of the LED to change

byte[] rgb

Byte array representing the color RGB values. byte[0] = Red, byte[1] = Green, byte[2] = Blue

Remarks

Ws2812
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Leds.Ws2812

Show()

Transmit the buffer to the LEDs

Declaration
public void Show()

Remarks

Ws2812
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Leds.Ws2812