Mission Briefing
By the end of this mission, you will be able to:
Explain what a potentiometer is and how it works
Describe the difference between analog and digital signals
Wire a potentiometer to the ESP32 correctly
Read and display a potentiometer's value using the Serial Monitor
Think of a volume knob on a speaker, or a dimmer switch on a lamp. Twist it and something changes smoothly, not just on or off. That's a potentiometer at work — and in this lesson, you'll wire one up and read exactly what it's telling your ESP32.
Robo says: “Every knob you've ever turned — volume, brightness, a game controller joystick — probably has a potentiometer inside. Let's learn to read one with code.”
What is a Potentiometer?
A potentiometer is a variable resistor with three pins. Turning its knob changes the resistance between the pins, which changes the voltage the ESP32 reads on the middle pin (called the wiper). That changing voltage is what your code turns into a number.
Analog vs. Digital
A digital signal can only be one of two values: HIGH or LOW (1 or 0) — like a light switch that's either on or off. An analog signal can be any value across a whole range — like a dimmer that can be anywhere between fully off and fully on. The ESP32's analogRead() function reads this kind of changing signal and returns a value from 0 to 4095, instead of just 0 or 1 like digitalRead().