The Kitronik ZIP Halo screws neatly onto the front of the BBC micro:bit and features 24 RGB light-emitting diodes (LEDs) arranged in a circle. Each LED can be individually addressed, allowing control of each LED's colour and brightness. The Halo has two screw holes to mount materials like perspex or timber in front or behind - this allows the LEDs to shine through cutouts or to light up specific areas, arranged in a circle, eg simulate a spinning wheel, or light up numbered cut-outs, or just highlighting segments on a round board set behind.
The Kitronik ZIP LEDs can be programmed in the same way as Adafruit NeoPixels, as documented in the BBC micro:bit MicroPython documentation found online at: https://microbit-micropython.readthedocs.io/en/latest/neopixel.html
Things to remember:
- The ZIP LEDs will need an external power source, which can be plugged into the Kitronik ZIP Halo using a battery pack fitted with a JST connector. This can also power the attached BBC micro:bit, but the micro:bit won't power the Halo.
- You need to create a NeoPixel object, and then use clear() to turn off all the LEDs at once, and write colour brightness (between 0 and 255) information to the pixels by addressing the NeoPixel object. Then just use show() to turn on the LEDs and show the changes.
Although there's examples included with the NeoPixel MicroPython documentation, here's a couple specifically taking advantage of the circular format of the Halo. Among the many editors you can use with MicroPython there's the mu editor, the online one, and plugins for other editors and browsers.
Make a blue light go round and round the Halo
Make the blue light accelerate by tilting the Halo and micro:bit to the right, and slow down when tilted to the left
Adding additional devices and ZIP LED arrays to the Halo
Don't forget that you can add more ZIP LED arrays to the Halo, to make more complex light shapes - you can find these on our store here.
The Halo exposes connections for additional ZIP arrays to be connected, ie marked as ZIP_EXT. To control these extra ZIP LEDs just requires num_of_pix to be increased.
For example, if you add a physical array of 5 ZIP LEDs:
- num_of_pix in the above code needs to be changed from 24 to 29.
- The if statement will need to check if p < 28 instead of p < 23
- The added ZIP LEDs lighting up when the value of p is between 25 and 29.
The contacts marked p1 and p2 can be used to connect to input devices such as sensors or switches, as they are connected to the p1 and p2 pins of the attached micro:bit.