NeoPixel Strand MakeCode

Programming the NeoPixel Strand in MakeCode is really easy, once you know where to look!

If you need information and tips on how to get started with MakeCode, they're on the "MakeCode Basics" page.

To look at, edit and run the test program shown at the top of this page, go to this link or click the button below.

So, here's the secret: When you click on the LIGHT menu, another menu called NEOPIXEL automatically appears under it! The blocks in this menu are for programming external NeoPixel strips like the Dots Strand in this project.

Before you can tell the LEDs what to do, you need to let MakeCode know where the NeoPixel strand is located, and how many LEDs it contains.

First, drag an on start block from the LOOPS menu onto the workspace.

Then go into the NEOPIXEL menu and drag a set [strip] to [create strip on [A1] with [30] pixels] block into the on start block.

If the strip is connected to Pin A1 (as it is in this example), you can leave that as is. Otherwise, change it to the correct pin name.

However, the strand only has 20 LEDs, so replace the "30" with "20" by simply clicking on the white space and typing over it.

 

To test that the NeoPixel strand is working, try one of the pre-made animations.

Just grab a [strip] show animation [rainbow] for [500] ms block from the NEOPIXEL menu and insert it in a forever block from the LOOPS menu.

Experiment with different animations or change the number of milliseconds it runs before it repeats.

To make your own animations, try playing around with some of the other blocks in the menu, such as the Photon blocks (which "draw" along the line of lights in the color you choose).

Go to the next page to see how to insert the strand into the masking tape hand. Then figure out ways to make special effects that will bring the hand to life!

This guide was first published on Oct 28, 2019. It was last updated on Oct 28, 2019. This page (NeoPixel Strand MakeCode) was last updated on Jan 11, 2020.