How to use a Potentiometer

Hello! Today we’re going to learn how to use a potentiometer with Arduino and get values from the Arduino.

What is a Potentiometer?

A potentiometer is a simple knob that provides a way of altering the amount of current flowing (variable resistance) that can be read to the Arduino and output Analog Values.

They come in variety of forms whether it’s Philip shape or a knob

Schematic

You then want to hook up the wires as shown up above

A potentiometer uses Analog instead of digital because digital is only used if we want to receive a HIGH output or a LOW output. With Analog, we can receive values anywhere ranging from 0-1023

Code

#define pin A5

void setup()
{
   Serial.begin(9500)
}
void loop()
{
  Serial.println(analogRead(A5));
  delay(1);
}