Using Circuit Playground Express NeoPixels

Using the on-Board Circuit Playground Express NeoPixels

The Circuit Playground Express has ten Neopixels of its own that can be programmed independently from the Crickit single NeoPixel and Crickit NeoPixel terminal block connection.


For the Crickit NeoPixels we used the NEOPIXEL subgroup of the LIGHT block group in MakeCode. For the Circuit Playground Express, you use the blocks directly in the LIGHT block group, not the NEOPIXELS subblock blocks.

The blocks in the LIGHT block group control the Circuit Playground Express' 10 NeoPixels

Below are two example programs (use one or another). The first just sets all the Circuit Playground Express LEDs to green. The second shows a rainbow animation for 5 seconds (= 5000 milliseconds), then shows a sparkle animation for another 5 seconds then loops back.

More on MakeCode and the Circuit Playground Express on the Introduction to Circuit Playground Express tutorial.


It takes a bit more code to do NeoPixels in CircuitPython. The easiest way is to use the library which sets everything up nicely. But the CPX library, as it's called, is large and when added to the Crickit support library adafruit_crickit, it does not leave a great amount of room for user programs.

The same effects in the CPX library may be done with the neopixel library, it is just coded a bit differently.

The code below shows opening up the NeoPixels on-board and performing some red and blue color animation which you are free to change as you wish. The code for the strips to change color in previous examples will work here also with appropriate variable name changes for the NeoPixel object opened.

# Use the 10 NeoPixels on Circuit Playground Express via the
#   Adafruit neopixel library
import time
import neopixel
import board

# Set up the 10 Circuit Playground Express NeoPixels half bright
CPX_pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, brightness=0.5)

# slowly power up via blue color
for i in range(50):
    CPX_pixels.fill((0, 0, i))

# blast off!
CPX_pixels.fill((255, 0, 0))

while True:
    # pulse effect
    for i in range(255, 0, -5):
        CPX_pixels.fill((i, 0, 0))
    for i in range(0, 255, 5):
        CPX_pixels.fill((i, 0, 0))
This guide was first published on Jul 18, 2018. It was last updated on Jul 18, 2018. This page (Using Circuit Playground Express NeoPixels) was last updated on Mar 25, 2019.