PWM CONCEPT
PWM speed control is a technique of transferring desired average power to the motor driver from arduino microcontroller by increasing or decreasing the pulse width of transferred square wave signal. This is also called a changing of duty cycle of signal of enable pin. This can be done by the pwm function of arduino using analogWrite() function and with the use of potentiometer.analogWrite(variable,0); means 0% duty cycle
analogWrite(variable,255); means 100% duty cycle
analogWrite(variable, 128); means 50 % duty cycle and so on
look and understand the figure below .