Led Controlled by Potentiometer using Arduino - Wired Connection | Arduino
Circuit Diagram:
Required components:
Arduino Uno/Nano: 1 Nos
Led light - 1 Nos
470k resister - 1 Nos
Potentiometer - 1 Nos
Program Code:
int ledPin = 6;
int potentiomenterInput = A1;
void setup() {
pinMode(ledPin, OUTPUT);
}
void loop() {
potentiomenterInput = (analogRead(A1)); // Divides input 0-1023 to resemble to 0-255
analogWrite(ledPin, potentiomenterInput);
// The delay can be change to get the desired dimming effect
delay(50);
}
Video:
Comments
Post a Comment