How to create a program that controls the speed of a servo using a potentiometer using arduino?

The Servo library that comes with the IDE has an example named Knob that does just that.