Crickit and Neopixels

NeoPixels are connected on three terminals labeled “NeoPixel”.  GND is connected to GND.  +5V to 5V, and the arrow terminal to the Din pin on the NeoPixel.  We are working with the Micro:bit version of the Crickit but the Circuit Playground Express version is similar.

Connecting your LED strip

The wires are held in by screw terminals.  In this example the black wire is G (ground), green wire is  (signal wire), and the red wire is 5v (power).   Using a mini screwdrivers, loosen the screws high enough to fit the wires in, put the wires in and tighten the screws back down to hold the wires in place.   If you notice in the picture on the left the screws are higher and the terminals are ready for the wires.  Do not remove the screws, just loosen them enough to fit the wires under and in the hole.  In the picture on the right you will notice the screws are tight and the wires are secured.

Coding your LED strip

You will need to add the NeoPixels extension to MakeCode to control NeoPixels. 

  1. Open the MakeCode Editor
  2. On the middle menu click Advanced and then Add Extension. 
  3. Look for and select the Adafruit NeoPixels extension. 
  4. You should now have a block group added to the middle menu called Neopixel which will have the blocks you need for NeoPixel control.

The Crickit connects the neopixel LED strip to pin 16 on the Micro:bit so in this example we are setting up the neoPixel strip to use pin 16.  Note we are setting this strip for 24 LEDs, you will need to modify this value with the amount of LEDs your strip has. 

The On Start start sets a variable named “strip” as 24 neopixels attached to pin 16 then it calls that “strip” to be rainbow patterned.

The Forever section then tells that strip, in order, to rotate the rainbow pattern through the 24 leds, show the change, pause for .25 seconds to slow it all down, and then repeat forever.