Hi all,
Thanks for making such a lively community around this library.
I’m trying to selectively dim parts of the LPD8806 string to even out the light on an installation. Wonder if anyone’s done this before? I’ve got some ideas but it’d be nice to see someone else’s implementation…
Do you mean like one of more blocks of pixels in the strip? Such as pixels 20-42 and 99-120 for example? I would probably make a subroutine and always call it right before .show()
In the subroutine have for loops loop over the pixels to dim. The dimming could be done several ways. You could subtract a specific amount from an HSV value if you knew it should always be 10 less for example, or you could reduce it by a certain percentage.
Have a look at this section on “Dimming and Brightening Colors” for some ideas:
Remember to consider wrap around (going below zero and suddenly having very bright pixels) if needed.
In the for loop doing the dimming you could also check to see if the pixel is black and just skip it if it is. Something like this for HSV:
if( leds[i].v > 0) {
[do your dimming]
}
Or perhaps like this for RGB:
if( leds[i].r || leds[i].g || leds[i].b > 0) {
[do your dimming]
}