void loop() { val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023) val = map(val, 0, 1023, 500, 5); // scale it to use it with the servo (value between 0 and 180) digitalWrite(ledpin, HIGH); delay(val); // waits for the servo to get there digitalWrite(ledpin, LOW); delay(val);}

And if you couldnt tell, the code is a modified copy of the knob servo code. That is the reason for the random describing side notes... i was to lazy to finish or delete them.

You could throw in another val = analogRead(potpin) and val = map(val, 0,1023, 500, 5); right after it sets the LED pin high, that way the delay is now based on the new value. I guess you could add it in again after the LED pin is set low if you wanted even more precision.