Hello all, I've been tinkering with a 16F88 and some RGB (actually RGBB) LEDs. I can successfully PWM the LED at 256 different linear duty cycles per color resulting in 24-bit color possibilities. This looks pretty good when ramping the colors up and down. Now the crux of the problem. I would like to vary all three colors continuously so that I end up with a good assortment of mixes. The problem is that no matter what kind of algorithms I come up with they either take way to long to cycle thru or they repeat and miss allot of colors I'd like to see. I can change LED colors up to every 13mS (one full period time) without causing ugly flashing. To hit all 16 million possible values would take about 60 hours, so this is not practical. What I've been doing is to use a perpetual loop that ramps the dutycycle all the way up and then ramp it back down (not allowing the value to stay at 0). The duty cycle of each color is varied by it's own delta value (1, -1, 2 etc..). I've experimented with different delta values and starting duty cycles. I get lots of nice colors, but not what I really want. What I need is some kind of randomization or some ideas for a good algorithm that would allow me to cycle thru a virtual rainbow (ideal). I need smooth, virtually imperceptible color changing. I would like for the "show" to take about 1 or 2 minutes. I currently use a pot to set the delay between color changes from 0 to 255mS so that I can settle on a final delay value empirically. The maximum acceptable update rate for the duty cycles is approx 80Hz or strange flashing occurs. Thanks for any ideas -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist