View on GitHub

pxt-ledmatrix

MakeCode extension for using WS2812b / Neopixel LED Strips and Matrices

Open this page at https://matthiasamberg.github.io/pxt-ledmatrix/

A micro:bit extension to drive WS2812b LED Matrices

Features

Setup / Detect the physical layout

Setup and attach your LED-matrix. Since LEDs matrices can have different physical setups. It is important to tell the makecode Editor some properties of your LED-Matrix. Use this code snippet to configure your matrix correctly:

Run the above snippet on your micro:bit. Some LEDs should now light up, if not, you may need to check your connectors (or if you set the right pin in your block).

Now the light of the ‘moving’ testpattern should start in the top left corner and move horizontally to the reight, once it’s at the end it should start on the left side again, one row down. Once you setup the color mode, first LED corner, LED direction and continuation properties correctly, you are ready to use your LED-Matrix. You can now remove the ‘test pattern’ block and write your programs.

Usage

See the example code in the makecode editor.

So the topmost-leftmost LED should have coordinates x=0 and y=0.

The LED at the bottom right should have coordinates x=(matrixwidth-1) and y=(matrixheight-1).

If the coordinates produce unexpected results, you may need to setup your physical matrix with the ‘physical layout’ block (see Setup above).

Advanced Usage

Auto Update

By default the LED Matrix gets updated after you update/set the color of an LED or any other operation (set brightness,…). This behaviour is simple but slow. Use the ‘auto update LED matrix’ block to disable this feature. However then you must use the ‘update’ Block whenever you want your changes pushed to the physical LEDs.

Currently Missing Features / TODOs

Use as Extension

This repository can be added as an extension in MakeCode.

Edit this project Build status badge

To edit this repository in MakeCode.

Blocks preview

This image shows the blocks code from the last commit in master. This image may take a few minutes to refresh.

A rendered view of the blocks

Metadata (used for search, rendering)