This is a Arduino library, but you’re using the ESP-IDF framework. These are not compatible to each other.
It seems to me that you’re trying to use a ESP32-C3 board with Arduino instead of the ESP-IDF SDK. Using the new Arduino 2.0 core which supports C3 board is an open issue (Support for the latest Arduino v2.0 · Issue #619 · platformio/platform-espressif32 · GitHub), and due to the war, we can’t expect anything there at the moment, but should instead pray for the developers to get out of this alive.
However, other uses have made custom platform extensions that can help you. I currently recommend for you using the platformio.ini
[env:esp32-c3-devkitm-1]
platform = https://github.com/Jason2866/platform-espressif32.git
board = esp32-c3-devkitm-1
framework = arduino
platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git
lib_deps = adafruit/Adafruit NeoPixel@^1.10.4
(Requires Git to be installed).
Be aware, this installs the bleeding edge platform and Arduino core, which might have bugs.
(I currently don’t recommend using the version at Support for the latest Arduino v2.0 · Issue #619 · platformio/platform-espressif32 · GitHub because String.replace()
has a bug that makes it unusable).
With this platformio.ini
and a src/main.cpp
of
#include <Arduino.h>
#include <Adafruit_NeoPixel.h>
void setup(){}
void loop(){}
I can compile successfully.
Dependency Graph
|-- <Adafruit NeoPixel> 1.10.4
Building in release mode
Compiling .pio\build\esp32-c3-devkitm-1\src\main.cpp.o
Linking .pio\build\esp32-c3-devkitm-1\firmware.elf
Retrieving maximum program size .pio\build\esp32-c3-devkitm-1\firmware.elf
Checking size .pio\build\esp32-c3-devkitm-1\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [ ] 2.8% (used 9216 bytes from 327680 bytes)
Flash: [= ] 13.0% (used 170118 bytes from 1310720 bytes)
Building .pio\build\esp32-c3-devkitm-1\firmware.bin
esptool.py v3.2.1
Creating esp32c3 image...
Merged 2 ELF sections
Successfully created esp32c3 image.
=======================[SUCCESS] Took 4.54 seconds =======================
Note: After saving the new platformio.ini
, PlatformIO will do a task refresh in which it downloads the new platform. This will take a few minutes to complete, depending on the internet and Github connection speed. Before the task refreshing has not finished, one should not press the Build button.
Note 2: If you already created a ESP-IDF project, then PlatformIO may have create CMakeLists.txt and src/main.c
etc. for you. You can delete these files and only create src/main.cpp with the code above.