PWM Frequency & Resolution - WPISmartmouse/Smartmouse_2018 GitHub Wiki

Frequency

The default PWM Frequency on the teensy is 488.28 Hz (source). This means that at 100Hz, our current control frequency, we are getting between 4 and 5 periods of the PWM per control loop. This is fairly reasonable. It's totally unacceptable if we increase to 650Hz, our target control frequency, because we'd get less than one. We need to increase it to the ideal frequency as listed in the source above, which is 234375Hz. This will give as more than enough complete wave forms per control loop.

how to set analog frequency for a motor

analogWriteFrequency(MOTOR_RIGHT_A, 234375);
analogWriteFrequency(MOTOR_RIGHT_B, 234375);

Resolution

We want enough resolution so that a change of 1 in the values passed to analogWrite just barely has any measurable effect. Any higher resolution is unnecessary and lower will mean poor velocity control.

how to set analog resolution (effects all analog write's)

analogWriteResolution(10);