// Pin connected to the onboard LED
const int ledPin = 13;
const int minBrightness = 1; // Minimum brightness level
void setup() {
// Initialize the onboard LED pin as an output
pinMode(ledPin, OUTPUT);
}
void loop() {
// Gradually increase brightness (fade in)
for (int brightness = minBrightness; brightness <= 255; brightness++) {
analogWrite(ledPin, brightness); // Set LED brightness using PWM
delay(15); // Small delay for a smooth transition
}
// Keeping the LED at full brightness for a moment
delay(500); // You can adjust the delay duration here
// Gradually decrease brightness (fade out)
for (int brightness = 255; brightness >= minBrightness; brightness--) {
analogWrite(ledPin, brightness); // Set LED brightness using PWM
delay(15); // Small delay for a smooth transition
}
// Keeping the LED at minimum brightness for a moment
delay(100); // You can adjust the delay duration here
}