Hello,
I’m using the H2-devkit platform from Jason2866 git and I encountered an issue while compiling the ledc functions to drive PWM.
Here is my platformio.ini:
[env:esp32-h2-devkitm-1]
platform = GitHub - Jason2866/platform-espressif32: Tasmota Espressif 32: development platform for PlatformIO
board = esp32-h2-devkitm-1
framework = arduino
upload_port = /dev/cu.usbmodem323101
monitor_speed = 460800
build_flags =
-D ARDUINO_USB_MODE=1
-D ARDUINO_USB_CDC_ON_BOOT=1
Here is a simple code to try the function:
#include <Arduino.h>
void setup()
{
ledcAttachPin(18, 0); // broche 18, canal 0.
ledcSetup(0, 5000, 12); // canal = 0, frequence = 5000 Hz, resolution = 12 bits
ledcWrite(0, 2048); // canal = 0, rapport cyclique = 2048
}
void loop()
{
}
I got an error on the ledcAttachPin, ledcSetup functions :
src/main.cpp: In function ‘void setup()’:
src/main.cpp:5:3: error: ‘ledcAttachPin’ was not declared in this scope; did you mean ‘ledcAttach’?
5 | ledcAttachPin(18, 0); // broche 18, canal 0.
| ^~~~~~~~~~~~~
| ledcAttach
src/main.cpp:6:3: error: ‘ledcSetup’ was not declared in this scope
6 | ledcSetup(0, 5000, 12); // canal = 0, frequence = 5000 Hz, resolution = 12 bits
| ^~~~~~~~~
*** [.pio\build\esp32-h2-devkitm-1\src\main.cpp.o] Error 1
And if I remove #include <Arduino.h>, I also have the error on ledcWrite:
src/main.cpp: In function ‘void setup()’:
src/main.cpp:5:3: error: ‘ledcAttachPin’ was not declared in this scope
5 | ledcAttachPin(18, 0); // broche 18, canal 0.
| ^~~~~~~~~~~~~
src/main.cpp:6:3: error: ‘ledcSetup’ was not declared in this scope
6 | ledcSetup(0, 5000, 12); // canal = 0, frequence = 5000 Hz, resolution = 12 bits
| ^~~~~~~~~
src/main.cpp:7:3: error: ‘ledcWrite’ was not declared in this scope
7 | ledcWrite(0, 2048); // canal = 0, rapport cyclique = 2048
| ^~~~~~~~~
Is it something to be done to correct this library access (?) issue?
Regards