Many of my projects make use PlatformIO to build the code and program the CPU. These projects specify the project parameters in the "platformio.ini" configuration file.

Quote from BWB on the MySensors forum

If we compare the Arduino IDE and PlatformIO, we have to acknowledge that we're dealing with two different target audiences here. As someone who has never written a single line of C code when I decided to get into programming and electronics almost two years ago, I really appreciated how simple and straight forward the Arduino IDE made it to program a microcontroller. Automatic prototype generation has already been mentioned, one-click compiling and uploading, library management through the GUI,... and in general, the IDE makes it rather difficult to accidentally damage something. It's so simple and yet, it allows you to write highly sophisticated programs even though it gets cumbersome quite fast. I think the folks over at Arduino seem to have acknowleged that, by developing the Arduino Pro IDE, providing a classic / basic and advanced mode, which sure is a step in the right direction.

PlatformIO is a whole different beast. A purely text-based configuration and (not always optional) CLI commands aren't things I'd recommend to a beginner. It's much easier to brick a MCU or cause other issues inadvertendly because it's more "bare bone".

I could list a whole lot of features PIO brings to the party, but it's easy enough to look them up on the website. They're all fine and useful, but in my oppinion, the biggest advantage of PIO is the possibility to integrate it into virtually any IDE or code editor you're already familiar with. It's a huge convenience and efficiency boost if you can keep using all the keyboard shortcuts you're used to already, along with all the advanced features other IDEs provide. PIO requires more commitment to understand and make use of it, but once you know how it's done, there's no going back.

In the end, I think it depends a lot on everyones individual needs and experience which environemt is preferential.

It is more strict to the C++ standards, you have to make function prototypes for example, but that was all I had to convert basically.

On that note, here's a quick tip to make a PlatformIO project compatible with the Arduino IDE: Rename the src folder to something meaningful like BlinkWithoutDelay and rename the main.cpp file to BlinkWithoutDelay.ino. This satisfies the Arduino IDE's convention, where the main file has the same name as the directory it is in. You then need to tell PIO where the code has been moved to inside platformio.ini:

src_dir = BlinkWithoutDelay

Now you can share the project with both PIO and Arduino IDE users and nobody should need to make any adjustments to get it working.

Use Platformio to build, upload and monitor

Use the following commands:

$ pio run
$ pio run -t upload
$ pio run -t monitor

The platformio.ini file

A typical platformio.ini file contains:

src_dir = TestDisplaySrc

platform = atmelavr
board = uno
framework = arduino
; here you can change the microcontroller:
board_build.mcu = atmega328p
; here you can change the MCU frequency
board_build.f_cpu = 16000000L
monitor_speed = 19200
lib_deps =
    13    ; adafruit/Adafruit GFX Library
    6214  ; Adafruit BusIO header:Adafruit_I2CDevice.h
    548   ; MySensors
    942   ; U8g2
src_build_flags =
Tags: domotica tools