Normal PWM setup

ozwurld:
i dont have an oscilloscope at the moment and theres no way ii know that i can use to see if the code really does output a PWM.

It seems pointless to go to all the trouble of trying to design your own replacement for a cheap and readily available component without access to the basic tools needed to judge how well it is working. If you're serious about doing the project, get the tools needed to do it properly.