Now that I have a skeleton of the final program setup, I wanted to workout the kinks in the RGB strobing algorithm. Ideally, I would use cosine waves to slowly transitions between different colors; similar to what’s shown below.
Alas, I forgot that MCU’s don’t really calculate trig functions, instead opting for look up tables. I don’t nearly have enough memory to accomplish this so I will use a linear version of this plot. I’ll add some variables to tweak the phase of the different signals.
I tried using the internal 8bit counter of this chip configured in CTC mode (Clear Timer on Compare match); however, the 8bit resolutions and frequency of this counter wasn’t very well suited for this function. The final linear implementation looks reasonable and can be tweaked by changing the RGB_SEED value. Here’s what it looks like with RGB_SEED_1 = 0x80d802. (Note that the seed value just changes the starting conditions of the different signals above)
The linear transitions definitely aren’t ideal, (see video), but its good enough for me.