groundFungus:
Use analogWrite(dutyCycle) to change duty cycle. With a pot use analogRead(potPin) and divide the result (0-1023) by 4 to get the 0-255 for analogWrite.
dutyCycle = analoRead(potPin) / 4;
analogWrite(dutyCycle);
Why do you want to control the PWM frequency?
Cause i want to make a dc dc converter. thanks for reply. i know how to change dutycyle already [i should say that before ]. i just need to know how to change freq with potantiometer..
The hardware timers can generate PWM. You adjust the frequency of the PWM by setting 'prescale' and 'TOP'. You set the duty-cycle by adjusting the Output Compare Register between 0 and TOP.