Convert Arduino file to C++ manually
Some Cloud & Desktop IDEs don’t support Arduino files (*.ino
and .pde
) because
they are not valid C/C++ based source files:
Missing includes such as
#include <Arduino.h>
Function declarations are omitted.
In this case, code completion and code linting do not work properly or are disabled. To avoid this issue you can manually convert your INO files to CPP.
For example, we have the next Demo.ino
file:
void setup () {
someFunction(13);
}
void loop() {
delay(1000);
}
void someFunction(int num) {
}
Let’s convert it to Demo.cpp
:
Add
#include <Arduino.h>
at the top of the source fileDeclare each custom function (excluding built-in, such as
setup
andloop
) before it will be called.
The final Demo.cpp
:
#include <Arduino.h>
void someFunction(int num);
void setup () {
someFunction(13);
}
void loop() {
delay(1000);
}
void someFunction(int num) {
}
Finish.