PlatformIO ESP32 with ESP-IDF minimal C++ example
By default, when you initialize a PlatformIO ESP-IDF project, it will generate main.c
- not a C++ but a pure C file
This minimal example instead uses main.cpp
(you can just rename your main.c
- see How to use C++ main.cpp with PlatformIO on ESP32 / esp-idf for a detailed list of steps to do).
#```cpp {filename=“main.cpp”} #include #include <freertos/FreeRTOS.h> #include <freertos/task.h>
extern “C” { void app_main(void); }
void app_main() { while(true) { printf(“Hello PlatformIO!\n”); // Wait for one second vTaskDelay(1000 / portTICK_PERIOD_MS); } }
platformio-esp32-with-esp-idf-minimal-c-example_block1.txt
Check out similar posts by category:
C/C++, ESP8266/ESP32, PlatformIO
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow