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/neopixel
Dave Conway-Jones b0c8b1e83f more node-red-nodes hardware section info updates
and update Pibrella to use latest nrgpio debounce thinking
2016-02-12 21:27:02 +00:00
..
scripts Add Pi Neopixel node 2016-01-11 21:23:23 +00:00
colours.js Let neopixel node support GRB as well as RGB 2016-01-29 20:08:30 +00:00
LICENSE Add Pi Neopixel node 2016-01-11 21:23:23 +00:00
neopix Add Pi Neopixel node 2016-01-11 21:23:23 +00:00
neopix.py Add needle mode to neopixel 2016-01-13 19:59:30 +00:00
neopixel.html more node-red-nodes hardware section info updates 2016-02-12 21:27:02 +00:00
neopixel.js Let neopixel node support GRB as well as RGB 2016-01-29 20:08:30 +00:00
package.json more node-red-nodes hardware section info updates 2016-02-12 21:27:02 +00:00
README.md remove xs console.log in neopixel 2016-01-18 13:06:38 +00:00

node-red-node-pi-neopixel

A Node-RED node to drive a strip of Neopixel or WS2812 LEDs from a Raspberry Pi.

Pre-requisites

The Neopixel python driver need to be pre-installed... The easiest way to get the driver installed is to use the Unicorn HAT drivers install script... see the Pimoroni Getting Started with Unicorn HAT page.

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

Install

Run the following command in the root directory of your Node-RED install. Usually this is ~/.node-red

npm install node-red-node-pi-neopixel

The data pin of the pixels should be connected to physical pin 12 - GPIO 18 of the Pi. Note: this may conflict with audio playback.

Usage

To set the background just set msg.payload to an html_colour name. Here is a list of html_colour names.

It also accepts a string triple rrr,ggg,bbb or #rrggbb

#### Bar Chart

Defaults style mode using configured foreground and background colours. The foreground colour is used to indicate the number of pixels or length required.

It accepts a number in msg.payload that can be either the number of pixels, or a percentage of the total length.

If you want to change the foreground colour, you can set msg.payload to a comma separated string of html_colour,length or length,html_colour. The foreground will then remain that colour until changed again.

Needle

It can also display a needle (single pixel) type gauge. The rest of the pixels are set to the background colour on one side, and the foreground colour on the other side of the indicated pixel.

If you want to change the needle colour, you can set msg.payload to a comma separated string of html_colour,length or length,html_colour.

Shift left and Shift right

You can also select shift modes where a single colour pixel is added to either the start or the end of the strip, shifting all the others along by one. In this mode the msg.payload can be specified as either an html colour name, an r,g,b triple or #rrggbb.

Low level "API"

The nth pixel of the string can be set by msg.payload with a CSV string n,r,g,b , where r, g and b are 0-255.

A range of pixels from position x to y can be set by msg.payload with a CSV string x,y,r,g,b