Node Red Neopixel Light up without animation

Hello i want to light up an led strip with 300 neopixels the problem ist that it takes about 10 seconds untill all oft the led are lid because the animation i want that all led lid at the same time so it takes no time
look here https://youtu.be/Qv1xr35TWCI

Hi @LostiLama you will have to provide more info. What node-red contrib nodes are you using? can you share your flow (CTRL+E to export)

NOTE: it is important to surround your code with three backticks
```
like this
```

See this post for more details - How to share code or flow json

[{"id":"3b7ecb73.eb21c4","type":"rpi-neopixels","z":"8272e5c7.c42568","name":"","gpio":"19","pixels":"300","bgnd":"","fgnd":"","wipe":"40","mode":"pixels","rgb":"rgb","brightness":"100","gamma":true,"x":900,"y":720,"wires":[]},{"id":"e389b89f.c8a8d8","type":"function","z":"8272e5c7.c42568","name":"Set Color","func":"var count = global.get('count')||0;\nmsg.payload = msg.payload.replace(/[rgb()\\s]/g,\"\");\nif(count===0){\n    msg.payload = msg.payload;\n}\nelse{\n    msg.payload = (count-1) + \",\" + msg.payload;\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":660,"y":720,"wires":[["3b7ecb73.eb21c4"]]},{"id":"e36ccfff.d7dca","type":"mqtt in","z":"8272e5c7.c42568","name":"","topic":"Color","qos":"2","datatype":"auto","broker":"13b6aee3.bab491","nl":false,"rap":true,"rh":0,"x":470,"y":720,"wires":[["e389b89f.c8a8d8"]]},{"id":"ab5b19.3a0b24e8","type":"mqtt in","z":"8272e5c7.c42568","name":"","topic":"LedStrip/Clear","qos":"2","datatype":"auto","broker":"13b6aee3.bab491","nl":false,"rap":true,"rh":0,"x":490,"y":780,"wires":[["3b7ecb73.eb21c4"]]},{"id":"13b6aee3.bab491","type":"mqtt-broker","name":"","broker":"192.168.178.33","port":"1883","clientid":"","usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""}]

Hi, in order to make code more readable and importable it is important to surround your code with three backticks
```
like this
```

You can edit and correct your post by clicking the pencil icon.

See this post for more details - How to share code or flow json

Also, you did not answer question...

what happens if you simply inject a colour into the neopixel node?

image

[{"id":"676d450422f68982","type":"inject","z":"553814a2.1248ec","name":"red 255,0,0","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"255,0,0","payloadType":"str","x":1030,"y":2860,"wires":[["f01a2574ab2565f0"]]},{"id":"1884efc8f14d542c","type":"inject","z":"553814a2.1248ec","name":"green 0,255,0","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0,255,0","payloadType":"str","x":1030,"y":2900,"wires":[["f01a2574ab2565f0"]]}]

Then the same happens only if i use 1,0,255,0 in this case lid led 1

[{"id":"27f367c8.1af8e8","type":"tab","label":"Neopixel ","disabled":false,"info":""},{"id":"70321037.9650f","type":"rpi-neopixels","z":"27f367c8.1af8e8","name":"","gpio":"19","pixels":"300","bgnd":"","fgnd":"","wipe":"40","mode":"pixels","rgb":"rgb","brightness":"100","gamma":true,"x":520,"y":140,"wires":[]},{"id":"f7dddf5d.96ae6","type":"function","z":"27f367c8.1af8e8","name":"Set Color","func":"var count = global.get('count')||0;\nmsg.payload = msg.payload.replace(/[rgb()\\s]/g,\"\");\nif(count===0){\n    msg.payload = msg.payload;\n}\nelse{\n    msg.payload = (count-1) + \",\" + msg.payload;\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":320,"y":140,"wires":[["70321037.9650f"]]},{"id":"e69658c3.0d1268","type":"mqtt in","z":"27f367c8.1af8e8","name":"","topic":"Color","qos":"2","datatype":"auto","broker":"13b6aee3.bab491","nl":false,"rap":true,"rh":0,"x":170,"y":140,"wires":[["f7dddf5d.96ae6"]]},{"id":"5f77569d.1a3bd8","type":"mqtt in","z":"27f367c8.1af8e8","name":"","topic":"LedStrip/Clear","qos":"2","datatype":"auto","broker":"13b6aee3.bab491","nl":false,"rap":true,"rh":0,"x":190,"y":200,"wires":[["70321037.9650f"]]},{"id":"13b6aee3.bab491","type":"mqtt-broker","name":"","broker":"192.168.178.33","port":"1883","clientid":"","usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""}]

but what if you inject 0,255,0 (just the RGB without the leading 1) - what happens?

Same animation it isnt the code it is the library

Then you'll probably have to ask in the issues on its repository

i didnt whant to deleat the feature but if it is possible can i a create a java script fort this ? i didnt know anything about java but it this possible ? maby somphing like this
injekt color 0,25,24 -> 1,0,25,24+ 2,0,25,24 + 3,0,25,24 ...

how many pixels are there?

what happens if you inject 100,255,0,0?
what happens if you inject 200,255,0,0?
what happens if you inject 1000,255,0,0?

then only the led that is 100,255,0,0 in this case 100 lids

How many LEDs are there on your strip?

300 neopixels but to use is 0 - 299 pixels

Try this...

[{"id":"db67a827c57bf8e5","type":"inject","z":"5d3f964c.fef898","name":"255,0,0","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"255,0,0","payloadType":"str","x":580,"y":1920,"wires":[["4c83bf8f553d25e9"]]},{"id":"4c83bf8f553d25e9","type":"function","z":"5d3f964c.fef898","name":"generate color pixels","func":"const pixels = 300;\nfor (let index = 0; index < pixels; index++) {\n    node.send( { payload: `${index},${msg.payload}` } );\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":790,"y":1920,"wires":[["32e2a6986eb3db8d"]]},{"id":"55a037d52ea4fed9","type":"inject","z":"5d3f964c.fef898","name":"0,255,0","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0,255,0","payloadType":"str","x":581.8958129882812,"y":1971.5555419921875,"wires":[["4c83bf8f553d25e9"]]},{"id":"32e2a6986eb3db8d","type":"debug","z":"5d3f964c.fef898","name":"to neopixel node","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1020,"y":1920,"wires":[]}]

connect the function to the neopixel node & press the injects - does that work?

1 Like

thats faster but not instant

without the library supporting such a feature, we have to work around its capabilities by generating the 300 pixel messages.

There may be a payload format that supports setting all - but i have no access to a device to try it out.

if you want you can look in the code if there is any stuff for that

the nodes built in helps says...

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

what happens if you inject 0,299,0,0,255 directly into the neopixel node?

it is the same as 0,0,255