Developing for Arduino in Windows using PlatformIO and JetBrains CLion

If you’re reading this, chances are you’re already familiar with Arduino and its… kind of limited IDE. The official development environment is pretty limited, and the moment the project grows a little bit it becomes very inconvenient.

Thankfully there are several alternatives, and one of the most interesting ones leverages PlatformIO, a cross-platform development environment for embedded programming, and Jetbrains CLion, nowdays the most advanced C/C++ IDE, period.


First of all, click here to go to the Jetbrains website and download CLion. There’s a free trial for 30 days, and some offers for students.

Next, you have to install PlatformIO Core, you have the instructions right here. There’s also PlatformIO IDE, the most popular option, which bundles VSCode as the default editor. But for us, PlatformIO Core is just fine. After installation you’ll have a “platformio” command available at your command prompt.

Creating your first project

Once you’ve downloaded and installed everything you need, open a command prompt, navigate to the folder where you want to store your project and run:

platformio init --ide clion --board uno

This will create the necessary files for you to start your project, including a simple main.cpp file to start coding. Now open CLion, choose open project and open the folder you’ve just created. The project pane on the left side should look something like this:

Place your source files in the include or src folders and you’re good to go.

Building the project

Building your newly coded project is pretty easy, as PlatformIO already creates predefined configurations to compile and upload the data. Most of the time you’ll be compiling and uploading at the same time, so the PLATFORMIO_UPLOAD target will be the most appropriate one. Select it from the combobox you’ll find in the toolbar and click the hammer button beside it. DO NOT CLICK RUN (the green triangle button). Before building, make sure your Arduino is connected to the PC.

Once the build finishes, you’ll see this in the messages pane at the bottom:

========================= [SUCCESS] Took 9.28 seconds =========================

Build finished

And that’s it.


There are a few quirks in this workflow, but that’s the price you have to pay if you want to use this incredible editor. So far I’ve come across the following:

  • Sometimes when building, the compiler will complain about a missing SPI.h file. Make sure you’re including the Arduino.h header file and reopen the project.
  • Whenever you need to add a new file to the project you’ll have to re-run the initial platformio command we just saw before.

You can always find more information at the official PlatformIO docs online.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.