MakeCode provides a rich library to more NeoPixel strips (see the API reference) connected on the pins of the Circuit Playground.

If you want to support an external NeoPixel strip, not the 10 built-in LEDs, you can create a strip instance and store it in a variable. You can configure the number and type of LEDs.

// mount an external Neopixel strip on pin A1 with 24 RGB pixels
let strip = light.createStrip(pins.A1, 24);

The example below mounts a NeoPixel strip on pin A1 and turns it to blue or red when buttons A or B are pressed.

To set all the colors on the pixels, use setAll:

// show blue on all pixels
strip.setAll(Colors.Blue)

You can also use the set pixel color block to set an individual pixel color.

// set colors one by one
for(let i = 0; i < strip.length(); ++i) {
    strip.setPixelColor(i, Colors.Green);
}

This guide was first published on May 30, 2017. It was last updated on Sep 27, 2017.

This page (External Strips) was last updated on May 25, 2017.

Text editor powered by tinymce.