Wurde doch schon gespostet
http://www.rn-wissen.de/index.php/Bascom_und_PWM
Grundprogramm -> Fertig.