// Define the pin for the LED
const int ledPin = 26;
void setup() {
// Set the LED pin as an output
pinMode(ledPin, OUTPUT);
}
void loop() {
// Dim to Bright
for (int brightness = 0; brightness <= 255; brightness++) {
analogWrite(ledPin, brightness); // Set the brightness
delay(10); // Small delay for smooth fading
}
// Bright to Dim
for (int brightness = 255; brightness >= 0; brightness--) {
analogWrite(ledPin, brightness); // Set the brightness
delay(10); // Small delay for smooth fading
}
}