16. LED Brightness Control Using PWM

Back To All Submissions
Previous Submission
Next Submission

Solving Approach:

How do you plan to solve it?

 

 

Code

/*Paste your code here*/
#define LED1 9
int Counter; 

void setup() {

  pinMode(LED1, OUTPUT);

}

void loop() {

  for (Counter=0;Counter<256;Counter++){
    delay(8);
    analogWrite(LED1,Counter);
  }

  for (Counter=255;Counter>=0;Counter--){
    delay(4);
    analogWrite(LED1,Counter);
  }

}
  



 

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