Error: 'ledcSetup' was not declared in this scope

I am starting a new project with Wemos D1 mini, trying to generate PWM.
When trying to use the “ledcSetup” command, I get the error:
‘ledcSetup’ was not declared in this scope

IDE: VisualStudio Code with platformIO

the platform,ini is:
platform = espressif8266
board = d1
framework = arduino

Should I include any library?
I was sure this command, as well as the ledcAttachPin are part of the 8266 family.

Which is totally correct. ldecSetup() is a function from Arduino-ESP32. You have an ESP8266 based board, hence you are using Arduino-ESP8266 where that function does not exist. Just use the regular analogWrite() function as explained in multiple tutorials.

1 Like