Rayan kiwan
Created July 9, 2022 © CERN-OHL2

Fading LED using Arduino

Hello all, in this project I will show you how to build fading LED project

BeginnerFull instructions provided14
Fading LED using Arduino

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
5 mm LED: Red
5 mm LED: Red
×1
Resistor 1k ohm
Resistor 1k ohm
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Schematics

Fading led

Code

fade Led

Arduino
// C++ code
//
int led =6;
int brightness =0;
int fadeAmount =5;
void setup()
{
  pinMode(led, OUTPUT);
}

void loop()
{
  analogWrite (led, brightness);
  brightness= brightness + fadeAmount;
  if (brightness <=0 || brightness >=255){
    fadeAmount =-fadeAmount;
  }
  delay(30);
}

Credits

Rayan kiwan
36 projects • 2 followers
Contact

Comments

Please log in or sign up to comment.