PID and motor control by PWM
Full duty cycle period will give you maximum speed and zero duty cycle will give you no rotation at all. Your error can be also 0 and maximum value when you want full speed and motor is not rotating. Full duty cycle is equal to full DC range to 5V, half period duty cycle is equal to 2.5V and so on. You need to make conversion from voltage you get as output in your calculation of PID to duty cycle. For example, if output of PID is 1V (in range 0-5V) your duty cycle should be 0.2. Hope this helps.