Sorry if this isn't posted in the correct section.
Hi all. I'm hoping to get some advice and maybe a solution here. I have a what should have been a simple project but it's got a bug that I cannot figure out a solution for. The project is for a simple stop light for a friend of mines kid to put in his clubhouse. It has six modes two of which use PWM. There's a mode button that will cycle through the modes. At anytime he'll be able to press any of the other three buttons that will turn on a given set of LEDs (green, yellow, red or any combination there of). Once one the color buttons is pressed, the mode is set to zero and the chosen LEDs comes on. Pressed again and the LEDs go off. Pretty simple. The issue is when in one of the PWM modes (mode 4 and mode 6), it will run for a few cycles and then reset back to mode zero and turn on the green LEDs. If I comment out the section of code that handles the individual color selections then there's not an issue at all. It will run as expected. The last test that I ran, I turned off the 12 volt power supply and ran it in mode six for several hours with no issues but as soon as I turned the 12 volts back on it immediately went into mode zero and the green LEDs came on.
Any thing you guys can suggest would be helpful.
Thanks. The post was over 9000 characters when I added the sketch so I uploaded it to Dropxox.
P.S.
This run fine on the bench using an Uno, breadboard and 5 volts supply to an individual LED per color. It's only an issue when using a 12 volt PS and controlling the LEDs on the stop light. The power supply is from a PC for both the 5 volts and 12 volts.