2016-01-11 22:21:54 +01:00
|
|
|
node-red-node-pi-unicorn-hat
|
|
|
|
============================
|
|
|
|
|
|
|
|
A <a href="http://nodered.org" target="_new">Node-RED</a> node to output to a
|
|
|
|
Raspberry Pi Unicorn HAT from Pimorini.
|
|
|
|
|
|
|
|
Pre-requisites
|
|
|
|
--------------
|
|
|
|
|
|
|
|
The Unicorn HAT python drivers need to be pre-installed... see the
|
2016-01-12 23:53:24 +01:00
|
|
|
<a href="http://learn.pimoroni.com/tutorial/unicorn-hat/getting-started-with-unicorn-hat" target="_new">
|
|
|
|
Pimoroni Getting Started with Unicorn HAT</a> page.
|
2016-01-11 22:21:54 +01:00
|
|
|
|
|
|
|
curl -sS get.pimoroni.com/unicornhat | bash
|
|
|
|
|
|
|
|
Install
|
|
|
|
-------
|
|
|
|
|
2016-03-02 14:25:52 +01:00
|
|
|
Run the following command in your Node-RED user directory - typically `~/.node-red`
|
2016-01-11 22:21:54 +01:00
|
|
|
|
2016-03-02 14:25:52 +01:00
|
|
|
npm i node-red-node-pi-unicorn-hat
|
2016-01-11 22:21:54 +01:00
|
|
|
|
|
|
|
Usage
|
|
|
|
-----
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
2016-01-12 23:53:24 +01:00
|
|
|
The brightness can also be set in the configuration. Defaults to 20% so as not
|
|
|
|
to blind you.
|
2016-01-11 22:21:54 +01:00
|
|
|
|
2016-03-22 23:42:31 +01:00
|
|
|
A pixel is set by a `payload` containing a CSV string `x,y,r,g,b` .
|
|
|
|
`x` and `y` can be a single pixel `0` to `7`, a range of pixels, eg `2-5`, or
|
|
|
|
`*` to indicate the whole line. Multiple pixels strings can also be sent as
|
|
|
|
`x1,y1,r1,g1,b1,x2,y2,r2,g2,b2,...` .
|
2016-01-11 22:21:54 +01:00
|
|
|
|
2016-03-22 23:42:31 +01:00
|
|
|
The background can also be set to a colour by setting `msg.payload` to an `r,g,b` triple.
|
2016-01-11 22:21:54 +01:00
|
|
|
|
2016-03-02 14:25:52 +01:00
|
|
|
Any msg with a `msg.topic` identifies a 'sprite', which can then be moved
|
2016-02-26 23:01:00 +01:00
|
|
|
independently of the background. A 'sprite' can be a single pixel, or a group of pixels.
|
2016-01-11 22:21:54 +01:00
|
|
|
|
2016-03-02 14:25:52 +01:00
|
|
|
Setting `msg.payload` to `0` will delete the sprite from the list identified by `msg.topic`.
|
2016-01-11 22:21:54 +01:00
|
|
|
|
2016-03-02 14:25:52 +01:00
|
|
|
Setting `msg.payload` to `DEL` delete any sprites - leaving the background.
|
2016-01-11 22:21:54 +01:00
|
|
|
|
2016-03-02 14:25:52 +01:00
|
|
|
Setting `msg.payload` to `CLS` will clear the display to off and delete any sprites.
|
2016-01-11 22:21:54 +01:00
|
|
|
|
2016-03-22 23:42:31 +01:00
|
|
|
The overall brightness may be set by setting `msg.payload` to `brightness,nn`, where `nn` is `0 to 100`.
|
2016-01-11 22:21:54 +01:00
|
|
|
|
2016-03-22 23:42:31 +01:00
|
|
|
The rotation may be set by setting `msg.payload` to `rotate,rr`, where `rr` is `0`, `90`, `180` or `270`.
|
2016-03-28 18:43:00 +02:00
|
|
|
|
|
|
|
Examples
|
|
|
|
--------
|
|
|
|
|
|
|
|
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.
|