I am looking to generate a clock signal on a pin of 720KHz with a 50% duty cycle. I would also like to be able to vary the frequency (let's say +/- 200kHz) based on a variable that could either be altered by the program or a sensor. How would I program PWM on a pin to give me the correct clock speed? I need it to run in the background, but still check on the variable running in the main loop to see what value the clock speed should be set to.
I looked through a tutorial on using timers, but I could not understand the way they are setting parameters due to the lack of commenting on what each command was doing. http://arduino.cc/en/Tutorial/SecretsOfArduinoPWM