Write the project¶
Identify the folders and files¶
The newly created project contains the following folders and files:
Template/
├── .builds
├── .vscode
├── LocalLibrary
├── .gitignore
├── Doxyfile.dox
├── main.cpp
├── Makefile
├── ReadMe.md
└── Template.ino
-
The folder
.buildscontains the build and link files, and the executables. -
The folder
.vscodecontains the parameters for Visual Studio Code. -
The folder
LocalLibrarycontains theLocalLibrary.hheader andLocalLibrary.cppcode for theLocalLibrarylibrary. They are provided as example. -
The file
.gitignorelists the files and folders to omit for the source control manager Git. -
The file
Doxyfile.doxlists the parameters for the documentation generator Doxygen. -
The file
main.cppcalls the appropriate core libraries, initialises the board, includes the sketch. Themain()function calls thesetup()andloop()functions from the sketch. Do not alter this file. -
The file
Makefileis the entry for the compilation processes. -
The file
ReadMe.mdis a notepad in Markdown. -
The
Template.inofile is where you write the sketch, with thesetup()andloop()functions and all the additional ones.
The files to edit are the Template.ino file for the sketch, the LocalLibrary.h header and LocalLibrary.cpp code for the LocalLibrary library.
A project can only have one .ino file, except for multi-threaded platforms.
Activate version management¶
To activate the version management,
-
Call the prompt Ctrl+Shift+P and then enter Git: Initialise Repository.
-
Press Enter to accept the default folder.
The additional folder .git is added to the project.
Template/
├── .builds
├── .vscode
├── LocalLibrary
├── .git
├── .gitignore
├── Doxyfile.dox
├── main.cpp
├── Makefile
├── ReadMe.md
└── Template.ino
Include Arduino on the main sketch¶
The main sketch requires to include the Arduino library.
#include "Arduino.h"