Help please with the NEOPIXEL node

Shoot me if you will, but I am missing something.

I have (finally) got around to trying to get some NeoPixel LEDs working on a RPI.

Installing the node and the required

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.

So I ran the script mentioned.

But I am missing which GPIO pin it uses.

Please.
Someone.

RTFM - https://flows.nodered.org/node/node-red-node-pi-neopixel

2 Likes

Yeah, ok. I missed it.

Pin 18

(If you are still reading this)

I got it working, but am now having problems understanding the modes.

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.

What is the difference between bar chart and Needle?
How do I shift left (or right)
I can't resolve the syntax to understand what I need to send to do these.

Maybe you could try them and see ?
I'm not sure what else to say apart from a bar is a bar and a needle is a single pixel.
They are all just different modes
image
In the shift modes (add to start or end) - as the info you actually quoted it says "In this mode the msg.payload can be specified as either an html colour name, an r,g,b triple or #rrggbb."

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.

Let's take apart that sentence.

(single pixel) That's one.
The rest of the pixels are set to the background colour so far so good.
and the foreground colour on the other side of the indicated pixel

Well that kinda messes with the single pixel notion.

up to the pixel the LEDs are set to the background colour.
the pixel not really explained what colour it is.
and the foreground colour on the other side of the indicated pixel.

Nah. That's a bar. Well, actually a reverse bar.

If you think the documentation can be improved, I'm sure that the author would be glad to accept a pull request to update it.

think of the BAR as being vertical where all pixels up to the specified value are lit up

think of the needle horizontal where the color change is the needle

No, I am just confused that I am being pointed to the documentation which is vague.
Though it may be for me to point out the problem, I can't get why people seem to think that because they understand something everyone else has to.

I asked, I didn't understand the answer and it is my fault.
Yeah. Ok. Story of my life.

@zenofmud
Yeah, I kind of get it.

But be it horizontal or vertical..... A bar is like the old VU meters that tape decks used to have.

a needle is a single pixel. Yeah. but that isn't what is written for that.
It says that upto the value all the LEDs are background colour. After the LED they are foreground colour.

That's a reverse bar to me.

Example: . = off. * = on.
Bar
****....

Needle
....*......

But how it is said:
....******

Then you do think it can be improved. So after you have got your flow working, see if you can do a better job. Have a go modifying the text to make it easier to understand. If you think your modified version is easier to understand, then submit it so that other that are in your situation in the future benefit from the time you spent working it out.

I am having enough trouble understanding what is happening here, now.

The node.... That is WAY in the future.

I accept it: I'm stupid!

I don't like it. I try to learn. All I get is "if you think . . . . . ."

Nah, I'm not going there.
I'm better than that - in light of a recent post of mine and what happened: I'm shutting up.

Keep reading the documentation and look at the shift modes

I haven't got to that yet.

I have it working in that I send it this:
(example)
0,0,128,0

Turn on first LED at 50% green.
It works.
and
0,0,0,0
Turns it off.
This is while the node is in bar - percentage of length mode.

And that doesn't make sense looking at it another time.

percentage of length.

I send 0,255,255,255

0%. Invalid.

OK ... it is

  • = foreground, . = background, *=needle

Bar
-----....
Needle
---*....

foreground and background are set in the node config so can be set to the same colour if you just want the needle to show. The needle defaults to white.
You can just send a single number for the payload to move the needle to the percentage of the length required.

Ok. I'd call that peak indication, but that is me getting picky.

I still don't really get it. But it is working in that I can send commands to turn individual LEDs on/off (with the colour set in the payload) but don't get the other bits.

As I pointed out:
How can I send 0,128,128,128 and it works (turns on first LED) if it is set to display percentage.

0% - That's nothing. Not the first.

Anyway, I'll stick my face back against the grind stone.
Though for me, I have it working to what I want at this stage.