diff --git a/src/lgfx/v1/platforms/esp32/Light_PWM.cpp b/src/lgfx/v1/platforms/esp32/Light_PWM.cpp index b165784a..e2d79f5d 100644 --- a/src/lgfx/v1/platforms/esp32/Light_PWM.cpp +++ b/src/lgfx/v1/platforms/esp32/Light_PWM.cpp @@ -109,7 +109,11 @@ namespace lgfx if (_cfg.invert) duty = (1 << PWM_BITS) - duty; #if defined ( ARDUINO ) +#if defined LEDC_USE_IDF_V5 + ledcWrite(_cfg.pin_bl, duty); +#else ledcWrite(_cfg.pwm_channel, duty); +#endif #elif SOC_LEDC_SUPPORT_HS_MODE ledc_set_duty(LEDC_HIGH_SPEED_MODE, (ledc_channel_t)_cfg.pwm_channel, duty); ledc_update_duty(LEDC_HIGH_SPEED_MODE, (ledc_channel_t)_cfg.pwm_channel);