WS2812Serial brigtness

Status
Not open for further replies.
This really depends on what is meant by "possible".

If you're asking whether a function exists to do this, then no. The library stores all the pixel data and only 1 brightness modifier number. It doesn't allocate memory for storing a separate brightness number for each pixel.

But if "possible" asks if there is some way to accomplish this, then yes, of course there are ways if you add code to do so.

For example, you might read the pixel data and multiply or divide by some number, then write it back. That may or may not be good enough. The numbers are integers and scaling will involve small round-off errors, which may or may not become problematic for your use.

A more extreme approach might allocate arrays to hold all the original pixel data and brightness setting for each pixel. Then you would make your own function to set the color or brightness, which write into one of those arrays and use data from the other to compute the required pixel data to give to WS2812Serial.
 
This really depends on what is meant by "possible".

If you're asking whether a function exists to do this, then no. The library stores all the pixel data and only 1 brightness modifier number. It doesn't allocate memory for storing a separate brightness number for each pixel.

But if "possible" asks if there is some way to accomplish this, then yes, of course there are ways if you add code to do so.

For example, you might read the pixel data and multiply or divide by some number, then write it back. That may or may not be good enough. The numbers are integers and scaling will involve small round-off errors, which may or may not become problematic for your use.

A more extreme approach might allocate arrays to hold all the original pixel data and brightness setting for each pixel. Then you would make your own function to set the color or brightness, which write into one of those arrays and use data from the other to compute the required pixel data to give to WS2812Serial.

thanks Paul, I will look closer at the library..
 
Status
Not open for further replies.
Back
Top