Control the speed of a motor using a potentiometer to vary the PWM duty cycle