OK, here's my old main() loop from PIC-land.
It's not beautiful, but it works. It was definitely a hack for some fun with a bunch of RGB LEDs I had on hand
The ISR in this code is a 'timer' interrupt, but you can ignore that and work with a zero-crossing interrupt if you need - or choose a zero-crossing SSR that does the work for you
The external calls are self-explanatory, this isn't meant to write the code for you but to give some ideas !!
It does add some interesting code to 'mix' between colours - as well as values for the non-linear response of the RGB response in the LEDs
main.c (11 KB)