How do you plan to solve it?
Configure a PWM pin as output to LED and then write code to vary the duty cycle.
/*Paste your code here*/
int ledPin = 9;
void setup()
{
pinMode(ledPin, OUTPUT);
}
void loop()
{
// Increase brightness
for (int brightness = 0; brightness <= 255; brightness++) {
analogWrite(ledPin, brightness); // Set PWM duty cycle
delay(8);
}
// Decrease brightness
for (int brightness = 255; brightness >= 0; brightness--) {
analogWrite(ledPin, brightness);
delay(4);
}
}
video of output (know more)
Add a photo of your hardware showing the output.