Arduino provides great out-of-the-box PWM capability, but not a simple way to modify the PWM frequency. To do that you need to work directly with the processor registers. This is my summary of hardware PWM control with a range of examples of controlling duty cycle and frequency with the Arduino UNO/ATmega328. As always, all notes, schematics and code are in the Little Electronics & Arduino Projects repo on GitHub