17. LED Brightness Control Using Potentiometer

Back To All Submissions
Previous Submission
Next Submission

Solving Approach:

How do you plan to solve it?

 

 

Code

/*Paste your code here*/
int potPin = A0;
int ledPin = 5;   // PWM pin

void setup() {}

void loop() {
  int value = analogRead(potPin);         // 0–1023
  int pwm = value/4;  // convert to PWM range
  analogWrite(ledPin, pwm);



 

Output

Video

Add video of output (know more)

 

 

 

 

 

Photo of Output

Add a photo of your hardware showing the output.

 

 

 

 

Was this helpful?
Upvote
Downvote