Fade in the LED

const int ledPin = 9; // PWM pin connected to the LED void setup() {pinMode(ledPin, OUTPUT); // Set the LED pin as output} void loop() {// Fade in the LEDfor (int brightness = 0; brightness <= 255; brightness++) {analogWrite(ledPin, brightness); // Set the brightnessdelay(10); // Delay for smooth fading} // Fade out the LEDfor (int … Continue reading Fade in the LED