6.1 Potentiometer

Let’s wire up an external analog component. The potentiometer. This is a variable resistor that can change how much it stops a current running through it. Look at its values moving. You might find this part as a volume switch on a car stereo.

Wire Like This

3.3V <–> Top Pin Potentiometer

A0 <–> Middle Pin Potentiometer

GND <–> Bottom Pin Potentiometer

Code Screenshot

Snap code for moving a sprite on the screen using a potentiometer.