Skip to main content

Class Ws2812

Represents WS2812/Neopixel Led(s)

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

Implements:
Meadow.Hardware.ISpiPeripheral

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; }

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

SetAllLeds(Color)

Set the color of all LEDs

View Source
Declaration
public void SetAllLeds(Color color)
Parameters
TypeNameDescription
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()

Implements

  • Meadow.Hardware.ISpiPeripheral