[another potentiometer]

Arduino: Knobs and Dials
(Analog Input)

Find your potentiometer (control knob). It's called a pot, for short.

It has three terminals, as shown in the pictures here.

If you wire the left and right ends up to ground and 5v, the middle terminal changes voltage as you twist the dial.

Computers usually deal with digital values, either 0 or 1. But with the pot, you'll been reading an analog value: it might be anything between 0 and 1023.

(Why 1023? That's 210 - 1 -- it's because the Arduino reads 10 bits worth of analog input.)

Wiring up your pot

[Potentiometer wired to analog pin] Leave your LED connected, and wire the pot up to the Arduino like this.

The black wire connects the left terminal of the pot to Gnd (ground).

The red wire connects to the Arduino's 5v.

The third wire connects the pot's middle terminal to the Arduino's analog input pin 0. (The colors aren't important -- you can use any colors you like.)

The Arduino will be able to read the voltage and watch it change as you twist the knob.

Analog Input sketch

To try it out, find File->Examples->03.Analog->AnalogInput and upload that sketch.

Now twiddle the dial. What happens?

The sketch is reading an analog value from analog pin 0, like this:

    sensorValue = analogRead(sensorPin);    

sensorValue is a variable that holds whatever value was read in. You can use sensorValue later in the program to do things like decide how long to delay between flashes.

Other things to try

You can do analog output, too, to make the LED brighter or dimmer. Once you have this sketch working, go to the analog output page to see how that works, and to find out how you can use the serial console for debugging.