A Node-RED node to output to a Raspberry Pi Unicorn HAT from Pimorini.
The Unicorn HAT python drivers need to be pre-installed... see the Pimoroni Getting Started with Unicorn HAT page.
curl -sS get.pimoroni.com/unicornhat | bash
Run the following command in your Node-RED user directory - typically
npm i node-red-node-pi-unicorn-hat
The background of the array can be configured using an 8x8 pixel sized png image, or by specifying a single colour using an r,g,b triple.
The brightness can also be set in the configuration. Defaults to 20% so as not to blind you.
A pixel is set by a
payload containing a CSV string
y can be a single pixel
7, a range of pixels, eg
* to indicate the whole line. Multiple pixels strings can also be sent as
The background can also be set to a colour by setting
msg.payload to an
Any msg with a
msg.topic identifies a 'sprite', which can then be moved
independently of the background. A 'sprite' can be a single pixel, or a group of pixels.
0 will delete the sprite from the list identified by
DEL delete any sprites - leaving the background.
CLS will clear the display to off and delete any sprites.
The overall brightness may be set by setting
0 to 100.
The rotation may be set by setting
Includes two example flows - found under
Menu - Import - Examples - pi unicorn-hat.
One shows drawing simple blocks and lines.
The other is a simple graphical clock that shows the current time in hours
and minutes using a number of coloured pixels.