Pulse Width Modulation (PWM) is a technique by which the width of a pulse is varied while keeping the frequency constant. PWM is generally used to control speed of the DC motors or servo motors.
code and circuit diagram
visit: http://www.electronicwings.com/pic/pi...