Platform IO IDE: an alternative to Arduino IDE

Hello,

Since a few month, I’ve migrate my development from Notepadd++ and Arduino IDE to Visual Studio Code with Platform IO IDE.
Platform IO is an IDE extension to Visual Studio Code. So with this environment, you can develop code for a lot of development board, exactly like Arduino IDE.
But Platform IO has many advantage compare to Arduino IDE. First, the text editor Visual Studio Code is much more efficient than Arduino text editor:

  • More powerfull autocompletion,
  • Background error checking: so most of syntax error are live reported, before compiling the scetch
  • When you call a function, the text editor directly display the parameter that the function need
  • By right click on a function, you can easily go to the declaration, the definition etc…

And a lot more other function.

But the most powerfull part is the projet management from platform IO.
With platform IO, when you create a projet, you choose the board of your project. The Platform IO will automatically configure the environment for this board. If this is the first time you use this board, all the required file, library and dependency are automatically downloaded.
You have inside your project a file call platform.ini, to configure your projet. Like: configure the serial monitor speed. So every time you open the serial monitor, he is configured according to your project.
You need a library for your projet ? Just add lines intos your platformio.ini file and platformio automatically download it. And library can be managed globaly (so available for all project) or locally (available only for the current project); So if for projects you need differents version of the same library, it’s easy to manage.

And as the environment developpment is configure with your projet, managing project on differents board become easy. Open our project for Arduino Nano: PlatformIO is automatically configured for Arduino Nano. Then you swith to your ESP32 porjet: just open your project for ESP32 and PlatformIO automatically reconfigure to ESP32.
So when you switch from a board to an other, you don’t have to reconfigure manually your IDE like Arduino IDE.

Here is some video who will better illustrate all the advantages of this platform compare to Arduino IDE:

Drawback: harder to grasp for beginners.

Math

3 Likes

Hi Math,

Are the projects you create compatible with the arduino sketches. In other words, can you still open it with Arduino IDE?
I use Visual Studio Code also for development. But then with arduino plug in. Works also. And solves two of the pros you mention.

  • Better editor
  • Save board type comport etc. with the project

Greetings,

Jaap

Hello,

Yes you can still open it with Arduino IDE. But what interest ? With PlatformIO, you can do Everything inside VSCode: compaling the code for your board, upload it on your board and test it by using the terminal of VSCode.

Math

Because some users just have Arduino IDE and might want to open and compile it with that.

2 Likes

Just been trying VS Code with PlatformIO. It seems to do most of the things right, but it also is missing a lot of things Visual Micro can do. The templates and creating classes etc i could not find in VC.

The big no for VisualCode would be once you make a project in it - that is all you can open it with. Visual Micro allows you to create the project using .h .c .cpp .hpp AND .ino files so even though it is a visual studio project, you don’t have to install VC and platformio - you can just open with arduino ide.

You can’t open a main.cpp in the src folder directly with “Open” from Arduino ide.

With platformio an VS Code you can setup your project in a way that is compatible to the Arduino IDE.
Can you elaborate on the template an generating classes? With VS Code it’s no problem to setup templates, autocomplete, code generation… There is a plugin for just about anything not support by default.

Yes i guess if you rename a bunch of things. Can you create an arduino IDE compatible project from the examples in the librairies. When i tried that, intellisense wasn’t supported for ino. Is there a plugin for that?

I guess the other question, have you tried Visual Micro on Visual Studio? The only thing you have to pay for is the debugging in the pro edition. It is just as easy to install Visual Studio as it is Visual Code - and then you can also work on the AgOpenGPS C# project.

I haven’t tried debugging in Visual Code yet.

An even bigger bigger question, have you tried Arduino 2.0 ? It has autocomplete, compatibility, everything. Without all the clutter. You can open existing projects etc.

After using Arduino for years, I’m slowly switching to Atom + Platform IO. I tried Arduino 2, but it seems clunky. Some stuff stops and starts working on it’s own, with no consistency. I am trying to get away from Arduino, for reasons not limited to:

Every time you hit Ctrl + F , the find window jumps to the center of the main window, even if it was already open somewhere else.

The find window is not incorporated into the main window, so it gets in the way of the code.

You cannot open a main.ino file inside a ‘src’ folder.

The build time on a large project is slow. Arduino does not utilize all processors.