Adjust LED Brightness Using Potentiometer

by MrSottong in Circuits > Arduino

2077 Views, 1 Favorites, 0 Comments

Adjust LED Brightness Using Potentiometer

photo_2019-10-30_21-21-48.jpg

In the previous article, I showed you how to read the ADC value from a Potensometer using Arduino.

And this time I will take advantage of the reading from the ADC value.

That is adjusting the brightness of the LED.

Required Components

photo_2019-10-30_21-24-03.jpg
IMG_6882.JPG
IMG_6885.JPG
IMG_6886.JPG

Components that need to be prepared :

Arduino Nano

Jumper Wire

Potentiometer

Resistor 1K

Blue LED

Project board

USB mini

Laptop

Assemble All Components

bitmap.png
1.jpg

See the picture above for the assembly guide,

Arduino to Component

A0 ==> 2. Potentiometer

GND ==> 1. Potentiometer & Katoda LED

+5V ==> 3. Potentiometer

D3 ==> Resistor series with leds

Programming

Capture.PNG

Copy the code below to your sketch :

int LED = 3;

void setup() { pinMode(LED, OUTPUT); Serial.begin(9600);}

void loop() {

int sensorValue = analogRead(A0)/4; analogWrite(LED, sensorValue); }

sketch in the form of the original file, can be downloaded here:

Result

Lef

See the video above to see the results.

When the potentiometer is rotated to the right, the led will be brighter.

When the potentiometer is rotated to the left, the LED will be dimmer.