Skip to content

NeoPixelBrightnessBus object

Michael Miller edited this page Mar 29, 2023 · 3 revisions

DEPRECATED: NeoPixelBrightnessBus should no longer be used!
It has been replaced by NeoPixelBusLg which incorporates brightness and gamma correction is a supportable way across different color features.


See NeoPixeBus object for more details on the general use of this object.
See NeoPixelBrightnessBus object API Reference for more details on the methods exposed.

This object is provided for backward compatibility support with the Adafruit library and is not a recommended technique due to the unwanted pitfalls you will run into. See the NeoPixelBufferShader example for a better approach.

This object differs from the normal NeoPixelBus by supporting a strip wide brightness feature. This brightness allows one place to set and query a general brightness of the entire strip. When the brightness is changed, all pixels will be modified and any new colors being set will be modified.
But this feature does come at a cost of sketch size and memory use. So if you don't need it; use the normal NeoPixelBus object instead.

Just like the normal NeoPixelObject, it must be constructed with a "feature" and a "method" object that define which pixels you are using and how they are updated.

NeoPixelBrightnessBus<NeoGrbFeature, Neo800KbpsMethod> strip(pixelCount, pixelPin);

Be warned, using the brightness feature can cause unwanted effects. These include:

  • Colors returned by GetPixelColor() are not the same ones set by calling SetPixelColor()
  • Subsequent calls to SetBrightness() may cause the colors to loose nuances and quantize. They may even go grey or completely black.
Clone this wiki locally