Compilation error: 'ledcSetup' was not declared in this scope
tried to point you to the Espressif documents that explain what are the differences between version 2.x and 3.x of the ESP32 API.
On 3.x version, ledcSetup() and ledcAttachPin() are no longer available. That means you have 2 options:
Rollback the version of the ESP32 board to the version 2.x OR modify your code according to the new API. Since the code is nor big or complex, I suggest the second option.
void setup() {
ledcAttach(LEDC_PIN, 50, LEDC_RESOLUTION);
}
and all ledcWrite functions thereafter will need to be:
ledcWrite(LEDC_PIN, dutyCycle);
LEDC
The LEDC API has been changed in order to support the Peripheral Manager and make it easier to use, as LEDC channels are now automatically assigned to pins. For more information about the new API, check LED Control (LEDC).
Removed APIs
ledcSetupledcAttachPin
New APIs
ledcAttachused to set up the LEDC pin (mergedledcSetupandledcAttachPinfunctions).ledcOutputInvertused to attach the interrupt to a timer using arguments.ledcFadeused to set up and start a fade on a given LEDC pin.ledcFadeWithInterruptused to set up and start a fade on a given LEDC pin with an interrupt.ledcFadeWithInterruptArgused to set up and start a fade on a given LEDC pin with an interrupt using arguments.
Changes in APIs
ledcDetachPinrenamed toledcDetach.- In all functions, input parameter
channelhas been changed topin.

