Created on: 2 August 2012
Updated on: 17 January 2023
An analog value on the Arduino pin A0 is changed using a potentiometer. The value read on this pin is used to change the brightness of an LED connected to Arduino pin 9.
An example sketch from the Arduino IDE is used in this easy Arduino tutorial for beginners. The circuit is built on a breadboard using readily available parts.
Besides an Arduino Uno or compatible board, USB cable, breadboard and wire links, you will need:
As an Amazon Associate I earn from qualifying purchases:
The following video shows that the brightness of the LED changes as the potentiometer shaft is turned.
File → Examples → 3.Analog → AnalogInOutSerial
Find the circuit diagram on the AnalogInOutSerial page of the Arduino website.
The LED is connected as was done in project 3 above and the potentiometer is connected as was done in project 1.
In the Arduino IDE, select File → Examples → 3.Analog → AnalogInOutSerial to open the sketch for this project. Upload the sketch to the Arduino board.
Turn the potentiometer shaft in one direction to see the LED get brighter. Turn the potentiometer shaft in the other direction to see the LED get dimmer.
Leave the potentiometer connected for the next project.