Generating PWM from PID to control DC motor

The normal frequency for Arduino PWM is 490 Hz (I think). You can change that, as mentioned in Reply #5.

When you have changed to frequency you can then use analogWrite() as normal. (By the way "analogWrite()" is not a very good description of what the function does - pwmGenerate() might have been a better name.)

...R