Added function definitions to all the example sketches #23
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
I am using Platformio to write my Arduino sketches. Platformio, by default creates a main.cpp file to have advanced options in the IDE. So I copied the example sketch into my main.cpp and the code was not building. I noticed that there were function declarations after loop() function but the function definitions were missing. So once I added the definitions, the code started compiling.
Later I discovered that if I compile it as *.ino file, arduino framework does this behind the scenes (link: https://community.platformio.org/t/order-of-function-declaration/4546/1)
In order to avoid compilation error when compiling it as *.c or *.cpp, I added a function definitions in all the example sketches. Now the code is compatible for *.ino, *.c and *.cpp files.