
What you’ll make
In this lesson your board reads a knob. This kind of knob is called a potentiometer7.
Turning the knob changes the voltage on its middle pin7.
The board reads that voltage as a number from 0 to 10231.
Turned all the way one way, the pin gets 0 volts and reads 0. Turned all the way back, it gets 5 volts and reads 10237.
See it first
Press Run, then slide the knob on the on-screen board. The number shows in the serial monitor. The plotter draws it as a line.
What you need
- For the on-screen board: nothing. It runs in this page.
- For a real board: an Arduino UNO R3, a USB cable, a knob and three jumper wires7.
Next, you’ll read the code one line at a time.
Sources for this page
- Arduino reference: analogRead
- Arduino tutorial: Analog Read Serial: what a potentiometer does; 0 V reads 0 and 5 V reads 1023