A simple library with one job: converting RGB colors to RGBW! Optimized for RGBW NeoPixel white color temperatures. Just enter the RGB correspondent of the white LEDs, and you are good to go! In addition, it has the option to correct the blue light tone, which is crucial to get an accurate color output on some RGBW LEDs.
You can get this library on the Arduino library manager, or download this repository as a zip
archive and install it to Arduino IDE. For further details on Arduino library installation, please check out this great guide on the Arduino website!
In addition to the documentation here, be sure to check out the example sketch to learn how the library works!
RGBWConverter converter(240, 215, 200, true);
Initializes an RGBWConverter
object with the name converter
with the neutral white values being 240, 215, 200; as well as enabling blue correction.
- Integer between 0-255. Sets the red value for the neutral white color of the RGBW NeoPixels.
- Integer between 0-255. Sets the green value for the neutral white color of the RGBW NeoPixels.
- Integer between 0-255. Sets the blue value for the neutral white color of the RGBW NeoPixels.
- Boolean. If set to
true
, enables the blue correction feature.
Neutral white values refer to the RGB value correspondent of the maximum white (W) setting on the RGBW NeoPixels. This is used to correct the color temperature while performing the color conversion, as the white (W) is often not a pure white color. The example values work pretty well for RGBW NeoPixel strips from Adafruit.
On some RGBW NeoPixels like the RGBW NeoPixel strips from Adafruit, the blue color is not pure blue and contains a little bit of white. The blue correction feature is used to correct the color on these NeoPixel LEDs.
converter.RGBToRGBW(53, 42, 153);
Uses the RGBToRGBW
method of the library to convert a given RGB color input to RGBW color in the form of a 4-element integer array.
- Integer between 0-255. Specifies the red value of the color you are willing to convert.
- Integer between 0-255. Specifies the green value of the color you are willing to convert.
- Integer between 0-255. Specifies the blue value of the color you are willing to convert.
Returns a 4-element integer array containing the converted RGBW values, each being between 0-255 and ordered as follows:
{R, G, B, W}
Licensed under the MIT License
Copyright (c) 2021 M. Bertan TarakΓ§Δ±oΔlu