I'd like to take a moment and explain what is happening, just in case.
A potentiometer is simply a resistor with a wiper (your center pin).

simulate this circuit – Schematic created using CircuitLab
A potentiometer will have a given value, such as 10K. This is the total resistance from pin 1 to pin 2. No matter where the wiper is, R1 + R2 will always equal the total resistance.
Say you turn your potentiometer to the left. As you turn, R1 will decrease, while R2 increases, because you are moving the wiper physically.
As you turn your potentiometer all the way to the left, R1 will be very close to 0 Ohms, effectively connecting Pin1 and your wiper. Therefore, R2 will be the total resistance of your potentiometer.
The potentiometer works for your scenario by creating a voltage divider. That is to say, because we are probing voltage between R1 and R2 (which can change via the wiper).
Placing a voltage across pins 1 and 3 (eg: 5V), the center pin will measure a voltage between 0V-5V depending on wiper position.
Vcc
andGND
, and the center pin to one of the analog inputs. \$\endgroup\$ – Eugene Sh. Jun 28 '16 at 18:37