GithubHelp home page GithubHelp logo

bertant / arduino-rgbwconverter Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 1.0 23 KB

Hue preserving RGB to RGBW conversion library for Arduino! Optimized for RGBW NeoPixel white color temperatures.

License: MIT License

C++ 100.00%

arduino-rgbwconverter's Introduction

Arduino RGBW Converter Library

πŸ‘€ Overview

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.

πŸš€ Installation

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!

πŸ’» Usage and Features

In addition to the documentation here, be sure to check out the example sketch to learn how the library works!

Initialization

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.

Arguments

  1. Integer between 0-255. Sets the red value for the neutral white color of the RGBW NeoPixels.
  2. Integer between 0-255. Sets the green value for the neutral white color of the RGBW NeoPixels.
  3. Integer between 0-255. Sets the blue value for the neutral white color of the RGBW NeoPixels.
  4. 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.

Converting RGB to RGBW!

converter.RGBToRGBW(53, 42, 153);

Uses the RGBToRGBWmethod of the library to convert a given RGB color input to RGBW color in the form of a 4-element integer array.

Arguments

  1. Integer between 0-255. Specifies the red value of the color you are willing to convert.
  2. Integer between 0-255. Specifies the green value of the color you are willing to convert.
  3. Integer between 0-255. Specifies the blue value of the color you are willing to convert.

Return Value

Returns a 4-element integer array containing the converted RGBW values, each being between 0-255 and ordered as follows:

{R, G, B, W}

πŸ“ƒ License

Licensed under the MIT License

Copyright (c) 2021 M. Bertan Tarakçıoğlu

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.