LED Brightness Control Using Potentiometer

Solving Approach:

How do you plan to solve it?

 

 

Code

/*Paste your code here*/

#define LED1 9
#define Pot A0
float Val; 

void setup() {

  pinMode(LED1, OUTPUT);

}

void loop() {

  Val = analogRead(Pot);
  Val = (Val/1023)*255 ; 
  analogWrite(LED1,Val);;
}
  


 

Output

Video

Add video of output (know more)

 

 

 

 

 

Photo of Output

Add a photo of your hardware showing the output.

 

 

 

 

Upvote
Downvote

Submit Your Solution

Note: Once submitted, your solution goes public, helping others learn from your approach!