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

There are example codes within the IDE. They are often useful to start from.
What code have You got running so far?