Starting Electronics Needs Your Help!
It is that time of the year when we need to pay for web hosting and buy new components and equipment for new tutorials. You can help by making a donation. Contribute to this website by clicking the Donate button. The total will be updated once daily. (You may need to clear your browser cache to see the updates.)

Target Amount: $2000
Amount Raised: $289

Donations Received

X

Project 6: Use a Potentiometer to Dim a LED (AnalogInOutSerial)

Created on: 2 August 2012

Tutorial 10 – Pages

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.




Parts Needed

  • 1 × LED (e.g. 3mm or 5mm red or green LED)
  • 1 × 220 ohm resistor (1/4W 5%)
  • 1 × 10k potentiometer

Amazon.com

Amazon.co.uk

Arduino Website Page

AnalogInOutSerial

In the Arduino IDE

File → Examples → 3.Analog → AnalogInOutSerial

Building the Circuit

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.

Programming and Operating the Circuit

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.

Project 6 Video


Can't see the video? View on YouTube →

← Go back to P5: tonePitchFollowerGo to P7: AnalogInput →