IoT

Analog Write LED Fadeup with Arduino UNO

Analog Write LED Fadeup with Arduino UNO
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);
  } 
}
UTKARSH KUNWAR

Freelance Developer, Security Researcher, Tech Geek, IoT & Machine Learning Enthusiast, Soul Traveller, Born to Ride Force to Work, Nature Lover & Good Photographer too.