I've tried a bunch of different ways without luck here...
I want a UI slider (0-100) to be able to vary the brightness of all of the pixels in a ring. I am utterly stumped on how to set msg.brightness. I have no trouble getting (for example) the #RRGGBB value from io.eclipse.org Cheerlights feed, manipulating it in a function node and fading from one tweeted color to the next using flow context variables (learning by doing). But connecting the output of the slider to the msg.brightness eludes me. Does it set all the pixels at once or is it set once for each pixel?
There is only one post here that mentions msg.brightness and I'm afraid it doesn't help. Can someone point me in the right direction?
Thanks.
--Jeff
I added the brightness function to the node so I may be able to help.....
msg.brightness sets brightness of all the LEDs
I recommend disabling gamma correction in the node config when using it as low values of brightness will not light up the LEDs
This should show it in action
[{"id":"705d63fe.01c29c","type":"inject","z":"ebdcdbcd.531b48","name":"","topic":"","payload":"red","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":870,"y":440,"wires":[["35d4d55f.0dd83a"]]},{"id":"3154e0ad.cfa47","type":"inject","z":"ebdcdbcd.531b48","name":"","topic":"","payload":"blue","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":870,"y":380,"wires":[["35d4d55f.0dd83a"]]},{"id":"35d4d55f.0dd83a","type":"rpi-neopixels","z":"ebdcdbcd.531b48","name":"","pixels":"21","bgnd":"","fgnd":"","wipe":"3","mode":"pixels","rgb":"rgb","brightness":"5","gamma":false,"x":1150,"y":320,"wires":[]},{"id":"2f20a909.38cb26","type":"inject","z":"ebdcdbcd.531b48","name":"","topic":"","payload":"5","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":430,"y":260,"wires":[["f3c80bb3.b56f48"]]},{"id":"719f7b9f.7c8d44","type":"inject","z":"ebdcdbcd.531b48","name":"","topic":"","payload":"50","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":430,"y":360,"wires":[["f3c80bb3.b56f48"]]},{"id":"48d977ad.d015e8","type":"inject","z":"ebdcdbcd.531b48","name":"","topic":"","payload":"100","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":430,"y":420,"wires":[["f3c80bb3.b56f48"]]},{"id":"f17fef50.c924e","type":"inject","z":"ebdcdbcd.531b48","name":"","topic":"","payload":"10","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":430,"y":300,"wires":[["f3c80bb3.b56f48"]]},{"id":"f3c80bb3.b56f48","type":"change","z":"ebdcdbcd.531b48","name":"","rules":[{"t":"set","p":"brightness","pt":"msg","to":"payload","tot":"msg"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":680,"y":320,"wires":[["35d4d55f.0dd83a"]]}]
Simon
Not sure exactly what problem you are having. Do you mean you don't know how to put the slider value into msg.brightness? If so then use a Change node set to Move msg.payload To msg.brightness.
Putting the slide value into msg.brightness is not the problem, it's that msg.brightness was not doing what I expected it to (change the brightness).
However, after trying Simon's example and having it not work, I checked my Neopixel node version and discovered I was still at 0.16 and not at 0.22. Once updated, everything worked as intended, including the slider. Which, as it turns out, is not really a good way to set the brightness of Nepixels.
@cymplecy thanks again for the (working) example.
Crisis averted.