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