1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00
node-red-nodes/hardware/unicorn
Dave Conway-Jones 5a5856fced
fix: upgrade pngjs from 2.2.0 to 2.3.1 (#911)
Snyk has created this PR to upgrade pngjs from 2.2.0 to 2.3.1.

See this package in npm:
https://www.npmjs.com/package/pngjs

See this project in Snyk:
https://app.snyk.io/org/dceejay/project/d423d0d8-60aa-4eae-823a-1cbe4be8a581?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <snyk-bot@snyk.io>
2022-05-18 13:27:35 +01:00
..
examples add tick to Unicorn clock example 2016-03-29 10:10:26 +01:00
LICENSE Update licenses and packages for all nodes 2016-11-06 20:26:19 +00:00
package.json fix: upgrade pngjs from 2.2.0 to 2.3.1 (#911) 2022-05-18 13:27:35 +01:00
README.md Add clock example to unicorn hat node 2016-03-28 17:43:00 +01:00
unicorn.html Update licenses and packages for all nodes 2016-11-06 20:26:19 +00:00
unicorn.js add check for python3 lib 2021-12-08 09:38:50 +00:00
unihat fix python2 fallback check (#892) 2022-03-11 17:49:55 +00:00
unihat.py Run flake8 linter on python code (#474) 2018-08-15 14:18:33 +01:00

node-red-node-pi-unicorn-hat

A Node-RED 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 Pimoroni Getting Started with Unicorn HAT page.

curl -sS get.pimoroni.com/unicornhat | bash

Install

Run the following command in your Node-RED user directory - typically ~/.node-red

npm i node-red-node-pi-unicorn-hat

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.

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 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,... .

The background can also be set to a colour by setting msg.payload to an r,g,b triple.

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.

Setting msg.payload to 0 will delete the sprite from the list identified by msg.topic.

Setting msg.payload to DEL delete any sprites - leaving the background.

Setting msg.payload to CLS will clear the display to off and delete any sprites.

The overall brightness may be set by setting msg.payload to brightness,nn, where nn is 0 to 100.

The rotation may be set by setting msg.payload to rotate,rr, where rr is 0, 90, 180 or 270.

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.