MOSFET Mayhem..

In the case of sketch 2

analogWrite(fadePin, sinOut);

creates a square wave on fadePin. That pin is connected through a small resistor (~150R) to the FET gate. The drain goes to the LED cathodes, source to GND. LED anodes to resistors and resistors to +V.

Also the FET should be a "logic level" FET that will turn on properly with just 5v on the gate.


Rob