PWM - added direction initialization, speed function