You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/esp-idf_component.rst
+24-8
Original file line number
Diff line number
Diff line change
@@ -5,15 +5,15 @@ Arduino as a ESP-IDF component
5
5
ESP32 Arduino lib-builder
6
6
-------------------------
7
7
8
-
For a simplified method, see `lib-builder <lib_builder>`_.
8
+
For a simplified method, see `lib-builder <https://github.com/espressif/esp32-arduino-lib-builder>`_.
9
9
10
10
Installation
11
11
------------
12
12
13
-
.. note:: Latest Arduino Core ESP32 version is now compatible with [ESP-IDF v4.4](https://github.com/espressif/esp-idf/tree/release/v4.4). Please consider this compability when using Arduino as component in ESP-IDF.
13
+
.. note:: Latest Arduino Core ESP32 version is now compatible with `ESP-IDF v4.4 <https://github.com/espressif/esp-idf/tree/release/v4.4>`_. Please consider this compability when using Arduino as component in ESP-IDF.
14
14
15
15
- Download and install `ESP-IDF <https://github.com/espressif/esp-idf>`_.
16
-
- Create blank idf project (from one of the examples).
16
+
- Create blank ESP-IDF project (use sample_project from /examples/get-started) or choose one of the examples.
17
17
- In the project folder, create a new folder called `components` and clone this repository inside the new created folder.
18
18
19
19
.. code-block:: bash
@@ -26,10 +26,19 @@ Installation
26
26
cd ../.. && \
27
27
idf.py menuconfig
28
28
29
+
Option 1. Using Arduino setup() and loop()
30
+
******************************************
29
31
30
32
- The `idf.py menuconfig` has some Arduino options.
31
-
- On `Autostart Arduino setup and loop on boot`.
32
-
- If you enable these options, your main.cpp should be formated like any other sketch.
33
+
- Turn on `Autostart Arduino setup and loop on boot`.
34
+
- In main folder rename file `main.c` to `main.cpp`.
35
+
- In main folder open file `CMakeList.txt` and change `main.c` to `main.cpp` as described below.
- Your main.cpp should be formated like any other sketch.
33
42
34
43
.. code-block:: c
35
44
@@ -45,14 +54,17 @@ Installation
45
54
delay(1000);
46
55
}
47
56
48
-
- Otherwise, you need to implement ```app_main()``` and call ```initArduino();``` in it.
57
+
Option 2. Using ESP-IDF appmain()
58
+
*********************************
59
+
60
+
- You need to implement ``app_main()`` and call ``initArduino();`` in it.
49
61
50
62
Keep in mind that setup() and loop() will not be called in this case.
51
63
If you plan to base your code on examples provided in `examples <https://github.com/espressif/esp-idf/tree/master/examples>`_, please make sure to move the app_main() function in main.cpp from the files in the example.
52
64
53
65
.. code-block:: cpp
54
66
55
-
//file: main.cpp
67
+
//file: main.c or main.cpp
56
68
#include "Arduino.h"
57
69
58
70
extern "C" void app_main()
@@ -69,7 +81,11 @@ If you plan to base your code on examples provided in `examples <https://github.
69
81
- If enabled, WiFi will start with the last known configuration
70
82
- Otherwise it will wait for WiFi.begin
71
83
72
-
- ```idf.py -p <your-board-serial-port> flash monitor``` will build, upload and open serial monitor to your board
84
+
Build, flash and monitor
85
+
************************
86
+
87
+
- For both options use command ``idf.py -p <your-board-serial-port> flash monitor``
88
+
- It will build, upload and open serial monitor to your board.
0 commit comments