Or in the Programming Questions.
The normal PWM signal with analogWrite() is about 450Hz.
Directly using the timers might conflict with Arduino libraries. I would not recommend it.
You can use the delay() and millis() function.
There is a map() function which can translate one range to another. Once you learn how to use it, it is a very handy function.
// example code, not tested.
const int time_total = 2000; // milliseconds for one PWM phase
...
void loop()
{
int time_on;
int pot;
int led;
pot = analogRead(pinPot);
// map the analog input range 0...1023 to a delay range 0 ... 2000 ms
time_on = map (pot, 0, 1023, 0, time_total);
digitalWrite( pinLed, HIGH);
delay(time_on);
digitalWrite( pinLed, LOW);
// wait remaining time for the total time of one PWM phase
delay(time_total - time_on);
}
If you need it to be fully off and on, the code should be extended to detect those conditions.