Skip to content

MakeCode Package using animations in MakeCode programs

Gavin Jancke edited this page Nov 30, 2020 · 6 revisions

Expressive Pixels for MakeCode

Expressive Pixels provides support for MakeCode, enabling animations to be rendered on display arrays based on WS2812B (NeoPixels) RGB LEDs.

Add the Extension

After creating you new MakeCode project, add the Expressive Pixels Extension by clicking on the Extensions button in the block picker, followed by entering the URL path to the Expressive Pixels MakeCode GitHub location.

Add Startup Blocks

Select the Expressive Pixels section in the block picker

Add the following blocks to the On Start section: The main Set EPXDisplay; A digital write pin on P1 i your display supports power enablement; and the powerupclear with low brightness to ensure the display array is cleared and set to a nominal brightness.

Copy the animation from Expressive Pixels application

In the Expressive Pixels applicaiton select the 'Copy Programmable MakeCode Binary declaration to Clipboard' ellipsis menuitem for the animation you wish to display on your MakeCode device's display. Specify the dimensions of your display array such as 16 x 16.

In the MakeCode editor, switch over to the JavaScript tab and paste in the declaration that is in the Windows Clipboard in the appropriate location below.

Add a play trigger

Going back to the Block editor, pick a trigger you wish to launch the animation from the Inputs block category, and specify the EPXDisplay play and show blocks.

Download the MakeCode program to the device

Now download th MakeCode program to your device, when you press the button you specified as a play trigger, the animation will play on your LED display array.

Supported targets

  • for PXT/microbit

License

MIT

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.