Project 7: Control the Flashing Rate of an LED using a Potentiometer (AnalogInput)

Created on: 2 August 2012
Updated on: 17 January 2023

Tutorial 10 – Pages

The analog value on the Arduino analog pin A0 is changed using a potentiometer. The value read on this pin by the Arduino is used to change the rate at which the on-board LED flashes.

An Arduino Uno is used in this easy tutorial for beginners in electronics. One of the example sketches from the Arduino IDE is used in this tutorial, so no code needs to be written.

Parts Needed

Besides an Arduino Uno or compatible board and a USB cable you will need:

1 × 10k potentiometer

Depending on the type of potentiometer, you may also need a breadboard and wire links. A potentiometer with wires soldered to it are shown in the video for this tutorial. Alternatives are to use a trim-pot and wire it from a breadboard, or use a panel mount potentiometer and Dupont wires.

Arduino Website Page

AnalogInput

In the Arduino IDE

File → Examples → 3.Analog → AnalogInput

Project 7 Video

The following video shows that turning the shaft of the potentiometer in one direction increases the flashing frequency of the Arduino on-board LED. Similarly, turning the potentiometer shaft in the other direction decreases the LED blink or flash rate.

Building the Circuit

Connect the potentiometer as shown on the Arduino website AnalogInput page.

Programming and Operating the Circuit

Open the sketch in the Arduino IDE (File → Examples → 3.Analog → AnalogInput) and then upload it to the Arduino board.

As the shaft of the potentiometer is rotated, the rate at which the Arduino on board "L" LED flashes will change.