Skip to main content

wokwi-led-matrix Reference

WS2812 NeoPixel Compatible LED Matrix.

LED Matrix

Pin names

NameDescription
DINData input signal
VDDPositive voltage supply
VSSGround
DOUTData output (for chaining to next panel)

Attributes

NameDescriptionDefault value
rowsNumber of rows"8"
colsNumber of columns"8"
layoutPixel wiring pattern (see below)""
brightnessBrightness multiplier"1"
pixelShapePixel rendering shape: "square", "circle", or """"
pixelSizeLED package size: "5050", "3535", or "2020""5050"

Layout

The layout attribute controls how pixel indices map to physical positions in the matrix:

  • "" (default) - Progressive: all rows go left-to-right
  • "serpentine" - Alternating row direction (left-to-right, then right-to-left)

Most real-world WS2812 matrix panels use serpentine wiring.

Pixel rendering

For pixel shape and size options, see wokwi-led-strip: Pixel rendering.

Arduino code example

#include <Adafruit_NeoPixel.h>

#define MATRIX_PIN 2
#define ROWS 8
#define COLS 8
#define NUM_PIXELS (ROWS * COLS)

Adafruit_NeoPixel matrix(NUM_PIXELS, MATRIX_PIN, NEO_GRB + NEO_KHZ800);

void setup() {
matrix.begin();
for (int i = 0; i < NUM_PIXELS; i++) {
matrix.setPixelColor(i, matrix.Color(0, 0, 150)); // Blue
}
matrix.show();
}

void loop() {
delay(10);
}

See also

Simulator examples