Visual Studio Code
Last updated
Last updated
For advanced developers and more complex projects, an advanced IDE can be beneficial. Visual Studio Code (VS Code) offers features like GIT control, code completion, and a variety of useful extensions to streamline the development process. By combining VS Code with PlatformIO, you get a powerful setup for your Thinger.io projects.
Benefits of Using Visual Studio Code with PlatformIO:
GIT Control: Easily manage your version control with integrated GIT support.
Code Completion: Enjoy enhanced code completion for faster and more accurate coding.
Extensions: Access a wide range of extensions to add functionality and improve productivity.
To get started, download and install Visual Studio Code and the PlatformIO extension.
Visual Studio Code is a free distribution source-code editor developed by Microsoft for Windows, Linux and macOS. It can be extended via extensions, available through a central repository to add language support, new programming languages, themes, and debuggers, or perform static code analysis. It can be downloaded for free from the official website.
PlatformIO is a cross-platform, cross-architecture, multi-framework professional tool for embedded systems engineers and software developers working on embedded products. It can be installed as an extension in Visual Studio Code.
Steps to Install PlatformIO:
Open Extensions in Visual Studio Code:
Press Ctrl + Shift + X
on Windows or Command + Shift + X
on Mac to open the Extensions view.
Search for PlatformIO:
In the Extensions view, type "PlatformIO" in the search bar.
Install PlatformIO:
Click on the PlatformIO IDE result.
Click the Install button.
Once installed, PlatformIO provides powerful features to enhance your development process for Thinger.io projects.
Once Visual Studio code with PlatformIO is installed, it is possible to create a new project for our specific board. For this purpose, we can access PIO Home, and click on the New Project
button:
For this example, we will be using the ESP32 board, so, in the Project Wizard
pop-up we enter a Project Name
, select the Espressif ESP32 Dev Module
, as a generic ESP32 board, and the Arduino
Framework. Once done, click on Finish
and wait PlatformIO to download the required toolchains for the device.
After the project initialization is done, PlatformIO generates a file structure like the following:
As shown in the above picture, each PlatformIO project has a configuration file named platformio.ini
in the root directory for the project. This is a INI-stylefile.
platformio.ini
has sections (each denoted by a [header]
) and key / value pairs within the sections. Lines beginning with ;
are ignored and may be used to provide comments.
In our default ESP32
project looks like the following:
Now, to start working with Thinger.io, it is required to add the Thinger.io client library using the lib_deps
property:
After this configuration is done, it is possible to start compiling for our device. A basic example for our ESP32 device will look like the following: