Arduino as a component

lucasmiti1
Posts: 1
Joined: Wed Jun 18, 2025 1:55 pm

Arduino as a component

Postby lucasmiti1 » Wed Jun 18, 2025 2:43 pm

Hello all,

I'm trying to get a program to work in ESP-IDF, using arduino as a component. I followed the guide here: https://docs.espressif.com/projects/ard ... onent.html but it isn't working.

Here's the procedure I'm following:

  • Create the example project:

Code: Select all

idf.py create-project-from-example "espressif/arduino-esp32^3.0.2:hello_world"
  • Set the board target:

Code: Select all

idf.py set-target esp32c3
  • Add components to the project:

Code: Select all

mkdir -p components && \
cd components && \
git clone https://github.com/espressif/arduino-esp32.git arduino && \
cd arduino && \
git submodule update --init --recursive && \
cd ../.. && \
idf.py menuconfig
  • Swap some file extensions from .c to .cpp:
-In main folder rename file main.c to main.cpp.
-In main folder open file CMakeLists.txt and change main.c to main.cpp as described below.

  • Turn on "Autostart Arduino setup and loop on boot" from menuconfig
Program used:

Code: Select all

//file: main.cpp
#include "Arduino.h"

void setup(){
  Serial.begin(115200);
  while(!Serial){
    ; // wait for serial port to connect
  }
}

void loop(){
    Serial.println("loop");
    delay(1000);
}
  • Then I flash and monitor the board:

Code: Select all

idf.py flash
idf.py monitor

However, "Hello world" is not being printed.


Things tried:

-I've flashed the board without Arduino as a component, and the example works.
-I've cloned arduino-ESP32 version 3.2.0 into components.
-I've also tried using ESP-IDF appmain() instead of void setup and loop.

Any ideas on what I might be missing or doing incorrectly?

Who is online

Users browsing this forum: Semrush [Bot] and 4 guests