Go Down

Topic: Dividing 765 PWM (RGB LED) Values to the 1440 minutes of a Day (Read 2226 times) previous topic - next topic


If it was me, I'd just code an algorithm to calculate the brightness of a single channel by during a range check to determine which of the three parts of that profile the current position was in, and a simple linear transform for each part to calculate the brightness. Do this three times with different offsets to get the correct phase between the three channels and you have your RGB values. Now you can apply your gamma correction and output them. This involves a lot more runtime overhead than a table lookup, but the amount of effort involved in coding it is similar (you have to populate the table somehow or other) and this code doesn't seem to be performance-critical.


I will use three 480 minute colour cycles offset and I will distribute 240 values throughout those cycles.

If you intend to implement gamma correction, you can simply code the curve into a look-up table: the fastest approach.

Go Up