Let the LEDs fade in turns.

A potentiometer is a variable resistor. It is made of an arc-shaped resistive element that is electronically divided into two parts by a wiper. Moving the wiper on the resistive element changes the proportion of the resistance on each side of it. This proportion is read by the Arduino board to determine the position.

The outer leads of the potentiometer are connected to +5 V and GND, the centre lead to an analog input.

Values are read between 0 and 1023*. In the circuit example above, this value is converted to the value range of 0 – 255 with the map function, and transmitted to an LED as analog output (PWM).