In this article we look at the Pico Unicorn, this board provides 112 RGB leds which are arranged in a 16×7 matrix, there are also 4 buttons available on the board for your usage.
The four switches are wired up as SW_A, SW_B, SW_X, and SW_Y.
Programming the Pico Unicorn is possible via C/C++ and MicroPython with libraries and examples available for both
- 16×7 matrix of RGB LEDs (112 total)
- Individual colour/brightness control of each LED
- 4 x tactile buttons
- Pre-soldered female headers for attaching to Pico
- Compatible with Raspberry Pi Pico.
- Fully assembled
You have 2 options, you can either plug directly in to your Pico but this means that you have no access to the GPIO pins or you can buy an expander board which you can connect the Pico and from 2 to 4 add on boards. We will look at expander options in a future articles.
The labels on the underside of Pico Unicorn Pack will show you which way round to plug it into your Pico – just match up the USB port with the markings on the board.
The easiest way to get started is by downloading and copying our custom MicroPython uf2 to your Pico, it includes the library you need to use this add-on
Here are a few examples
import picounicorn import time picounicorn.init() # From CPython Lib/colorsys.py def hsv_to_rgb(h, s, v): if s == 0.0: return v, v, v i = int(h * 6.0) f = (h * 6.0) - i p = v * (1.0 - s) q = v * (1.0 - s * f) t = v * (1.0 - s * (1.0 - f)) i = i % 6 if i == 0: return v, t, p if i == 1: return q, v, p if i == 2: return p, v, t if i == 3: return p, q, v if i == 4: return t, p, v if i == 5: return v, p, q w = picounicorn.get_width() h = picounicorn.get_height() while True: t = time.ticks_ms() / 3600 for x in range(w): for y in range(h): r, g, b = [int(c * 255) for c in hsv_to_rgb(t + ((x + y) / w / 4), 1.0, 1.0)] picounicorn.set_pixel(x, y, r, g, b) time.sleep(1.0 / 60)
and another example
import picounicorn, utime, urandom picounicorn.init() while True: x = urandom.randint(0,15) y = urandom.randint(0,6) r = urandom.randint(0,255) g = urandom.randint(0,255) b = urandom.randint(0,255) picounicorn.set_pixel(x,y,r,g,b) utime.sleep(0.1)
This board is ideal for displaying messages or animations.
|Pico||Raspberry Pi Pico Development Board A Low-Cost High-Performance Microcontroller Board RP2040 Cortex-M0+ Dual-Core ARM Processor|
|Pico Unicorn pack UK||Pimoroni-Pico-Unicorn-Pack|