Used PWM to control the motor.