Problem to compile with ESP32 board after board support installation success

Problem to compile with ESP32 board after board support installation success

Hi,
I need some help for the board ESP32 support in IDE.

I have installed the ESP32 board support with this tutorial:

it means i use this link :https://dl.espressif.com/dl/package_esp32_index.json

and then i activate the board support , and i works because i saw the differents ESP32 board in the menu. (Tools/board)
The problem is the following:
When i choose my board, (DOITESP32 dev1 for example) and if i try to compile a example i have a compile error : (for exemple if i compile "fading" the simply example provided with the IDE)

The following error message :

Arduino : 1.8.10 (Windows 10), Carte : "ESP32 Dev Module, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, None"C:\Users\F085404\Documents\Perso\SmartHomeTrainerDIY\arduino-1.8.10\examples\03.Analog\Fading\Fading.ino: In function 'void loop()':Fading:30:34: error: 'analogWrite' was not declared in this scope analogWrite(ledPin, fadeValue); ^Fading:38:34: error: 'analogWrite' was not declared in this scope analogWrite(ledPin, fadeValue); ^exit status 1
'analogWrite' was not declared in this scopeCe rapport pourrait être plus détaillé avec
l'option "Afficher les résultats détaillés de la compilation"
activée dans Fichier -> Préférences.

And if i choose a UNO board it's OK of course...

any suggestions??

thanks
Vincent

The error is because the ESP32 developers never wrote an analogWrite function for the ESP32. You can read all the details and find several workarounds here:

Thank you very much!
I understand.
And where can I see the API which is supported by the ESP32 compiler?
Is there a big difference with the API of Arduino ?
best regards.
Vincent

Each Arduino boards platform bundles its own core library. This core library is where the standardized Arduino API is implemented. Ideally, you wouldn't even notice that a different core library was being used between an Uno and an ESP32 because the APIs should be as similar as possible, even if the underlying implementations must be very different for each microcontroller's architecture. In some cases, there are such significant differences between chips that the API can't be the same. In other cases, the authors of the core library just weren't as dedicated as they might have been to the goal of achieving compatibility with the standardized Arduino API. In the case of the analogWrite function and ESP32, it seems to be a mixture of the two.

You can see the ESP32 core library here:
https://github.com/espressif/arduino-esp32/tree/master/cores/esp32