@@ -73,16 +73,17 @@ After the setup you can save and exit:
73
73
- Close confirmation window [Enter] or [Space] or [Esc]
74
74
- Quit [Q]
75
75
76
- Option 1. Using Arduino setup() and loop()
77
- ******************************************
76
+ As the Arduino libraries use C++ features, you will need to swap some file extensions from ``.c `` to ``.cpp ``:
78
77
79
78
- In main folder rename file `main.c ` to `main.cpp `.
79
+ - In main folder open file `CMakeLists.txt ` and change `main.c ` to `main.cpp ` as described below.
80
80
81
- - In main folder open file `CMakeList.txt ` and change `main.c ` to `main.cpp ` as described below.
81
+ Option 1. Using Arduino setup() and loop()
82
+ ******************************************
82
83
83
- - Your main.cpp should be formatted like any other sketch.
84
+ Your main.cpp should be formatted like any other sketch. Don't forget to include `` Arduino.h `` .
84
85
85
- .. code-block :: c
86
+ .. code-block :: cpp
86
87
87
88
//file: main.cpp
88
89
#include "Arduino.h"
@@ -102,14 +103,14 @@ Option 1. Using Arduino setup() and loop()
102
103
Option 2. Using ESP-IDF appmain()
103
104
*********************************
104
105
105
- In main.c or main. cpp you need to implement ``app_main() `` and call ``initArduino(); `` in it.
106
+ In main.cpp you need to implement ``app_main() `` and call ``initArduino(); `` in it.
106
107
107
108
Keep in mind that setup() and loop() will not be called in this case.
108
109
Furthermore the ``app_main() `` is single execution as a normal function so if you need an infinite loop as in Arduino place it there.
109
110
110
111
.. code-block :: cpp
111
112
112
- //file: main.c or main. cpp
113
+ //file: main.cpp
113
114
#include "Arduino.h"
114
115
115
116
extern "C" void app_main()
@@ -141,7 +142,7 @@ Build, flash and monitor
141
142
142
143
- After a successful flash, you may need to press the RST button again
143
144
144
- - To terminate the serial monitor press [ Ctrl] + [ ] ]
145
+ - To terminate the serial monitor press `` Ctrl `` + `` ] ``
145
146
146
147
Logging To Serial
147
148
-----------------
@@ -179,7 +180,7 @@ Download the library:
179
180
180
181
.. code-block :: bash
181
182
182
- cd ~ /esp/esp-idf/components/arduino-esp32 /
183
+ cd ~ /esp/esp-idf/components/arduino/
183
184
git clone --recursive git@github.com:Author/new_library.git libraries/new_library
184
185
185
186
0 commit comments