Pages: 1 [2]   Go Down
Author Topic: Dividing 765 PWM (RGB LED) Values to the 1440 minutes of a Day  (Read 1230 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Shannon Member
Karma: 223
Posts: 12630
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 only provide help via the forum - please do not contact me for private consultancy.

Offline Offline
Edison Member
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Pages: 1 [2]   Go Up
Jump to: