The Circuit Playground Express version of Crickit hardwires the NeoPixel control to Circuit Playground Express pad A1 as shown at left.
MakeCode knows all about it and provides support via the LIGHTS block group which will show a NEOPIXELS sub block group for handling strips and other "off-board" NeoPixels like the NeoPixel terminal on Crickit.
There is also one Crickit NeoPixel MakeCode allows you to control.
Cricket connected NeoPixels are connected to the three terminals on the NeoPixel block as shown at left for the micro:bit version of Crickit.
GND is connected to GND, +5V to 5V, and the middle arrow terminal to the NeoPixel's Din pin.
You will need to add the appropriate microcontroller (Circuit Playground Express or micro:bit) to the appropriate version of Crickit to control things, of course (they are not shown for clarity).
Crickit easily allows you to work with NeoPixels. There is one on-board to the right of the Capacitive Touch pads. There is also a terminal block called NeoPixel next to the Crickit Speaker terminal output. The NeoPixel terminal connections makes it super easy to use a strip or ring of NeoPixels to light up anything.
You can use the three special NeoPixel blocks in the CRICKIT block group extension to change the single NeoPixel on-board Crickit. They work just like the NeoPixel blocks under the LIGHT block group but just for the one Crickit pixel.
Crickit for Circuit Playground Express and Feather (micro:bit is below)
Within MakeCode for Circuit Playground Express, in the LIGHT block group, there is a special subgroup that pops below LIGHT when LIGHT is pushed called ... NEOPIXEL. This provides a huge number of blocks to work with NeoPixels that are not on your Crickit or the microcontroller on Crickit like a Circuit Playground Express.
When you use the MakeCode NeoPixel blocks to manipulate your Crickit connected NeoPixels, you need to use the NEOPIXEL subgroup block labeled set strip to create strip
.
For the code below, it assumes a connected 30 NeoPixel strip to the Crickit NeoPixel terminal block.
When the program starts, the on start
code up the variable named strip
to refer to a NeoPixel strip connected to A1
(which all Circuit Playground Express Crickit strips are connected to) with 30
NeoPixels on it (You have to click the +
on the block to specify the pin A1
and add the number of NeoPixels.
For micro:bit + Crickit
For micro:bit, there is a small sun icon on Pin P16 on Crickit to help you remember that is the pin connected for NeoPixels.
You will probably need to add the NeoPixels extension to MakeCode for NeoPixel control. Click the Advanced button then Add Package. Select the Adafruit NeoPixels extension. You will now have a new code block group called Neopixel which has the blocks you want to control the NeoPixel strip.
The code below does what the above code does for CPX - creates a strip of 30 NeoPixels connected to Pin 16 and then displays a rainbow animation forever.
Then the program shows the rainbow animation on the strip forever. You can do lots of other things on your strip. It's that easy!
For More Information
See the tutorial Make It Glow with Crickit.
Text editor powered by tinymce.