We used your PWM code to run a strip of RGB LEDs. And it Worked. I don't understand why you are using an op-amp. We used a PWM channel and connected the signal wire to the base of a BC547 NPN transistor and grounded the circuit along with the PWMs black ground wire.(The Red Wire was unused). We used the PWM signal with three transistors, each one controlling the different colors of the RGB LED strip, and we were able to create many combinations of colors. The following schematic attached to this post is what the circuit looks like for 1 channel for controlling a string of LEDs. The 12 volt supply is from the power distribution board and we put a 20 amp breaker for that slot. Note that this is for 1 channel. Also, Thanks for the code! It really helped us make some cool colors!
[IMG]/Users/13hong_jeremy/Downloads/schemeit-project.png[/IMG]
