const int ledPin=23;
const int frequency=500;
const int ledChannel=0;
const int resolution=8;
void setup() {
// configure the pwm functionalites
ledcSetup(ledChannel,frequency,resolution);
//attach the channel to gpio to be controlled
ledcAttachPin(ledPin,ledChannel);
}
void loop() {
// to increase led brightness
for(int dutyCycle=0;dutyCycle<=255;dutyCycle++)
{
//changing the led brightness with pwm
ledcWrite(ledChannel,dutyCycle);
delay(15);
}
}