- A potentiometer is basic mechanical device that provides a varying amount of resistance, when its shaft is moved.
- By allowing voltage to pass through potentiometer into an analog input, you can be able to measure the resistance generated by potentiometer as an analog value
Components Required
- Arduino Board
- 10k ohm Potentiometer
- Wires
Procedure
- Connect one of the outer pins in the potentiometer to the ground.
- Connect the other outer pin to 5 volts
- Connect the middle pin of the potentiometer to the analog pin A0.

-
Open the Arduino Editor on your computer.
-
In the setup function, type the following:
|
|
- In the loop function, declare a variable to store resistance value
int readValue = analogRead(A0);
- On the same loop function print the value to serial monitor like so:
|
|
Full source Code
|
|