# Node Red Neopixel Light up without animation

**URL:** <https://discourse.nodered.org/t/node-red-neopixel-light-up-without-animation/46770>\
**Category:** General\
**Created:** [6 June 2021 11:12 UTC](https://discourse.nodered.org/t/node-red-neopixel-light-up-without-animation/46770 "2021-06-06T11:12:47Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![LostiLama](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lostilama/32/42930_2.png) [@LostiLama](https://discourse.nodered.org/u/LostiLama)\
**Post date:** [6 June 2021 11:12 UTC](https://discourse.nodered.org/t/node-red-neopixel-light-up-without-animation/46770/1 "2021-06-06T11:12:47Z")

</div>

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](https://youtu.be/Qv1xr35TWCI)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [6 June 2021 11:16 UTC](https://discourse.nodered.org/t/node-red-neopixel-light-up-without-animation/46770/2 "2021-06-06T11:16:19Z")

</div>

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](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506)

---

<div class="post-metadata">

**Author:** ![LostiLama](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lostilama/32/42930_2.png) [@LostiLama](https://discourse.nodered.org/u/LostiLama)\
**Post date:** [6 June 2021 11:20 UTC](https://discourse.nodered.org/t/node-red-neopixel-light-up-without-animation/46770/3 "2021-06-06T11:20:51Z")

</div>

```auto
[{"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":""}]

```

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [6 June 2021 11:22 UTC](https://discourse.nodered.org/t/node-red-neopixel-light-up-without-animation/46770/4 "2021-06-06T11:22:28Z")

</div>

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](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506)

Also, you did not answer question...

> [@Steve-Mcl](#):
>
> What node-red contrib nodes are you using?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [6 June 2021 11:30 UTC](https://discourse.nodered.org/t/node-red-neopixel-light-up-without-animation/46770/5 "2021-06-06T11:30:05Z")

</div>

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

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/6/16d1689ca3bdc69ed88384e190dfdf7d33c2d051.png)

```auto
[{"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"]]}]

```

---

<div class="post-metadata">

**Author:** ![LostiLama](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lostilama/32/42930_2.png) [@LostiLama](https://discourse.nodered.org/u/LostiLama)\
**Post date:** [6 June 2021 11:48 UTC](https://discourse.nodered.org/t/node-red-neopixel-light-up-without-animation/46770/6 "2021-06-06T11:48:47Z")

</div>

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

```auto
[{"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":""}]

```

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [6 June 2021 11:51 UTC](https://discourse.nodered.org/t/node-red-neopixel-light-up-without-animation/46770/7 "2021-06-06T11:51:16Z")

</div>

> [@LostiLama](#):
>
> Then the same happens only if i use 1,0,255,0 in this case lid led 1

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

---

<div class="post-metadata">

**Author:** ![LostiLama](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lostilama/32/42930_2.png) [@LostiLama](https://discourse.nodered.org/u/LostiLama)\
**Post date:** [6 June 2021 11:55 UTC](https://discourse.nodered.org/t/node-red-neopixel-light-up-without-animation/46770/8 "2021-06-06T11:55:30Z")

</div>

Same animation it isnt the code it is the library

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [6 June 2021 12:08 UTC](https://discourse.nodered.org/t/node-red-neopixel-light-up-without-animation/46770/9 "2021-06-06T12:08:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![LostiLama](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lostilama/32/42930_2.png) [@LostiLama](https://discourse.nodered.org/u/LostiLama)\
**Post date:** [6 June 2021 12:13 UTC](https://discourse.nodered.org/t/node-red-neopixel-light-up-without-animation/46770/10 "2021-06-06T12:13:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [6 June 2021 12:19 UTC](https://discourse.nodered.org/t/node-red-neopixel-light-up-without-animation/46770/11 "2021-06-06T12:19:17Z")

</div>

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`?

---

<div class="post-metadata">

**Author:** ![LostiLama](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lostilama/32/42930_2.png) [@LostiLama](https://discourse.nodered.org/u/LostiLama)\
**Post date:** [6 June 2021 12:22 UTC](https://discourse.nodered.org/t/node-red-neopixel-light-up-without-animation/46770/12 "2021-06-06T12:22:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [6 June 2021 12:25 UTC](https://discourse.nodered.org/t/node-red-neopixel-light-up-without-animation/46770/13 "2021-06-06T12:25:16Z")

</div>

> [@Steve-Mcl](#):
>
> how many pixels are there?

How many LEDs are there on your strip?

---

<div class="post-metadata">

**Author:** ![LostiLama](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lostilama/32/42930_2.png) [@LostiLama](https://discourse.nodered.org/u/LostiLama)\
**Post date:** [6 June 2021 12:25 UTC](https://discourse.nodered.org/t/node-red-neopixel-light-up-without-animation/46770/14 "2021-06-06T12:25:30Z")

</div>

300 neopixels but to use is 0 - 299 pixels

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [6 June 2021 12:29 UTC](https://discourse.nodered.org/t/node-red-neopixel-light-up-without-animation/46770/15 "2021-06-06T12:29:53Z")

</div>

Try this...

```auto
[{"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?

---

<div class="post-metadata">

**Author:** ![LostiLama](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lostilama/32/42930_2.png) [@LostiLama](https://discourse.nodered.org/u/LostiLama)\
**Post date:** [6 June 2021 12:32 UTC](https://discourse.nodered.org/t/node-red-neopixel-light-up-without-animation/46770/16 "2021-06-06T12:32:35Z")

</div>

> [@Steve-Mcl](#):
>
> `[{"id":"db`

thats faster but not instant

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [6 June 2021 12:34 UTC](https://discourse.nodered.org/t/node-red-neopixel-light-up-without-animation/46770/17 "2021-06-06T12:34:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![LostiLama](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lostilama/32/42930_2.png) [@LostiLama](https://discourse.nodered.org/u/LostiLama)\
**Post date:** [6 June 2021 12:37 UTC](https://discourse.nodered.org/t/node-red-neopixel-light-up-without-animation/46770/18 "2021-06-06T12:37:53Z")

</div>

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

> **[node-red/node-red-nodes](https://github.com/node-red/node-red-nodes/tree/master/hardware/neopixel)**
>
> master/hardware/neopixel

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [6 June 2021 12:39 UTC](https://discourse.nodered.org/t/node-red-neopixel-light-up-without-animation/46770/19 "2021-06-06T12:39:06Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![LostiLama](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lostilama/32/42930_2.png) [@LostiLama](https://discourse.nodered.org/u/LostiLama)\
**Post date:** [6 June 2021 12:42 UTC](https://discourse.nodered.org/t/node-red-neopixel-light-up-without-animation/46770/20 "2021-06-06T12:42:19Z")

</div>

> [@Steve-Mcl](#):
>
> 0,299,0,0,255

it is the same as 0,0,255

[Next page](https://discourse.nodered.org/t/node-red-neopixel-light-up-without-animation/46770.md?page=2)
