Control motor position with direction signal and pwm signal for position