Loading, please wait...

A to Z Full Forms and Acronyms

Analog Write LED Fadeup with Arduino UNO

Jul 09, 2018 IoT, Arduino, Analog Write, Led Fade, 1169 Views
This is a basic Led brightness increasing and decreasing programme using Analog Write.
void setup() {
  pinMode(3, OUTPUT); // select any PWM pin as output
}

void loop() {
  // for increasing the brightness of Led
  for (int i = 0; i <= 255; i++)
  {
    analogWrite(3, i);
    delay(10);
  }
  // for decreasing the brightness of Led
  for (int i = 255; i >= 0; i--)
  {
    analogWrite(3, i);
    delay(10);
  } 
}
A to Z Full Forms and Acronyms

Related Article