I have 400 RGB ws2812 and would like to display different LED’s in different colours and intensities.
As an example LED 1-9 off, LED 10 orange with 50%, LED 11 red with 100%, LED 12 orange with 50% LED 22 in other colour and intensity,… etc, etc . I would like to save this as a fixed sequence and call it up on demand. To do this, I could send a Json via MQTT ore something from NodeRed
Is this possible and how should the Json look like to control a selection of LEDs. This sequence would then not change for several hours, so once sent, this display would remain for a longer period of time.
You can create a preset using the API commands to assign specific LEDs and/or segments of different lengths lengths. Once you save the preset it can be recalled as needed.
Checkout the KB for more details :Presets
Thank you for the answer. I have already tried this and failed because each individual LED could not be addressed in terms of colour and intensity.
Is there a way to write this in the form of a json? Are there any instructions on how a json should be structured?
led1 = Orange 50%
led2 = off
led3 = blue 75%
led399 = red 100%
led400 = green 20%
The KB has a section on the JSON API.
There are specific API commands to control single LEDs.
The other way to get a quick handle on it is to create segments of single LEDs, set the colours you want and save it as a preset.
Then go back into the preset and uncheck “Overwrite with state”, refresh the screen and you’ll see what gets saved as a JSON command.
That should point you at the proper syntax details to do others.
What’s your application for this?
I have a picture that is printed on translucent cloth and I would like to illuminate this picture from the back differently depending on the time of day. E.G. at night only with the street lamps, during the day with the sun and so on.
I have failed so far to control a single LED specifically with Json. Multiplying this is purely a matter of hard work, but I already failed with the first one because there is so much Json information and I am not a born programmer
Try starting simple and create 3 segments for three street lamps.
A segment can have a start and stop number corresponding to which LEDs in the strip you want to light.
Once you’ve built a simple segment, make it all one colour and save that as a preset.
Make another preset even it’s just a copy of the first with a different colour and/or brightness.
Save the 2nd preset.
Prove to yourself you can call up those presets and get the lights to change.
Now go into one of the presets and uncheck “Overwrite with state”, refresh the screen and you should see the underlying JSON for that preset.
Save that as a 3rd preset and activate the 3rd preset.
Start “tweaking” parts of the json by hand on screen to prove you can get things to change and perhaps understand what goes where.
This is definitely a tedious process especially if you’ve never done it before and don’t know where to look.
That’s why I suggest you start at segements, which are a bit more “GUI friendly” and then migrate down to the underlying JSON.
Stick with it and I promise it will make sense (eventually).
Another possibility would be to create a new ledmap, but I suspect that would just change where in a segment you have to make entries not the total number of entries.