Bought a BlinkStick flex a couple of weeks ago and noticed that only the first 8 LEDs worked with certain methods (note: I’m using the .Net wrapper). For example, when I call .Pulse() I can see it’s only pulsing the first 8.
That’s fine since I then realised the API exposes ways of addressing each LED invidually, which extends right up until the 32nd LED which is cool. So now I can call ‘morph’ or ‘setcolor’ on each LED. The problem is that each ‘setcolor’ or ‘morph’ call locks the thread up for some time. Not long at all, fractions of a second, but with it not being instant - it means I have no way of turning all 32 LEDs on/off/to a particular color at once.
I’d like to also morph all at once too. I’m using this LED strip as a status indicator you see - so white is pending state, green is good, red is bad, and I need the whole strip to change all at once to signify the change in status as fast as possible.
What is the approach to this? I’m busy in work but when I get home I plan to dispatch each method onto it’s own thread, but not sure how the LED will cope with that?
The Python API has a function called set_led_data. You give it the channel and the intensity for red, green, and blue for each LED and you can control the entire strip at once.
Looks like in the .NET wrapper that function is called SetColors, you can find it here.
Hm, it sure looks like it’s the same function as in Python. They both take two arguments, a channel and a big long bytearray of LED color data. So based on that…
SetColors will set as many LEDs as you give it data to set. For 32 LEDs, you’re going to feed it a bytearray with 96 elements in total, 3 for each channel on each LED.