Introduction
Connect three Crazy Circuits NeoPixels to a Bit Board and control them with code.
We'll explore how to control a series of three RGB LEDs (also called "NeoPixels").
Tools
Video Overview
Featured Document
-
-
We'll use Maker Tape to connect the three NeoPixels to the Bit Board on a LEGO baseplate.
-
The NeoPixels need to be chained together. You'll notice the labels DI and DO on each one. These stand for Digital Input and Digital Output.
-
From the Bit Board, Pin 0 connects to the DI (center hole) of the NeoPixel on the left side. We then connect the DO from the first one to the DI of the second one, and so on...
-
Make sure you don't bridge the connection of DI and DO beneath a NeoPixel, or that will short the circuit and bypass that NeoPixel. (If one does not light up, check for this.)
-
You'll also need to connect the three NeoPixels to Ground (GND) and to 3.3v as shown.
-
You'll notice the Ground on the Bit Board (as well as the NeoPixel and other Crazy Circuits components we'll use) is color coded White.
-
The 3.3v hole on the Bit Board is labeled and is actually two holes right next to each other on the Bit Board. (There is a small line showing the connection between them.)
-
-
-
If you've never used a micro:bit before you'll want to check out this guide: Bit Board V2 Setup and Use
-
We're going to load the following code for our Three NeoPixels Range program: https://makecode.microbit.org/_FyaiXTX3E...
-
We can select certain NeoPixels by setting a range. A range requires you to specify which NeoPixel in the string to start with, and then how many NeoPixels are in the range.
-
For this example each range contains just one NeoPixel. While the output is simple (lighting up one NeoPixel at a time) the range function allows us to do more advanced things with longer strips of NeoPixels.
-
Note that we are redefining (reusing) the range variable each time we set it, but for more complex code we might create a number of different ranges.
-
-
-
Once the code is loaded it should start running immediately.
-
You can power the micro:bit via the USB cable you used to load the code or you can use a battery pack plugged into the Bit Board.
-
You should see the left NeoPixel light up red, then turn off, then the middle one light up green, then turn off, and finally the right one light up blue, and then turn off.
-
If you look at the code we're actually turning off all of the NeoPixels before we turn one on.
-
-
-
Follow along with our recorded Live Stream!
-
You can watch the full video of us walking through this project, along with explaining and exploring the code: https://www.youtube.com/live/_pM0oZnZ9wQ...
-
