A potentiometer is basically just a dial. Depending on its rotation, it will read in a value between 0 and 1023 to use in your Arduino program.
This post details how to hook up a potentiometer to an Arduino.
int pot = 0;
val = analogRead(pot); // read the pot's analog pin, store it in val
Serial.println(val); // print the value of val
delay(100); // delay the program for 0.1 seconds
The potentiometer changes the resistance depending on how much it is turned. This relates to the value (0 – 1023) that is read in from the analog pin.
Now that the values are being read in successfully, you can use simple if-else statements in your next project. The following code turns on the on-board LED (which has a built-in resistor) if the potentiometer’s value is over 500.
if(val > 500) digitalWrite(13, HIGH);
else digitalWrite(13, LOW);
Typical computer game gas pedals use potentiometers to output the value that represents the position of the pedals.