Setup JetBrains Clion for Arduino Development




About: My name is Adam Luptak I creatively enthusiast for software development and everything related to information technologies. On the other hand, I am musician guitarist who loves creative things

Hi my name is adam, I love to work with Arduino for my hobby projects, but I find that Arduino IDE not very attractive and helpful tool. This days programmers have a lot of IDEs which do auto-complete, auto-formating code, show you mistakes and best practice before you push compile and run button. I work with Jet Brains IDES in my opinion they are the best and they can give you license free for open source projects. But if you wanna use it for programming arduino you have to done a little setup. In next steps I will show you all need to know for successfully install IDE and upload code to Arduino.

Advantages of Clion Arduino IDE:

  1. Auto-complete code
  2. Code formatter
  3. Intelligent refactoring tools
  4. Controlling code for mistakes and best practice without compiling and uploading
  5. Version control (Git, SVN, etc.)

Ps: I will use linux ubuntu mate, but it will works on windows Os to.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: 1. Download and Install Clion

Download Clion from

this website

Step 2: 2. Install Plug-gin for Arduino and Serial Port Monitor

Open Clion and go to Configure/Settings/Pluggins. Choose 'Browse Repositories' and click install, then restart Clion.

For use same approach as for Arduino plugin.

Step 3: 3. Do Little Setup for Arduino Board

After you installed

the plugin, you will see in Welcom window New Arduino Project click and start new arduino project.

PS: I like Dracula color theme in Clion, you can switch to it in File/Settings/Appearance & Behavior/Appearance switch Theme to Dracula.

In project you have
to most important files One “.ino” where is your code for Arduino, and the second which is named CMakeLists.txt where we need to do a little configuration. At line 6 you setup

what type of Arduino you are using (for my setup is “uno”). And at line 7 you setup port where is

Arduino connected to computer. Thats it for setup :)

Step 4: 4. Upload and Run Code

And for the last step you have to upload sketch to Arduino.

void setup() {
pinMode(13,OUTPUT); Serial.begin(9600); }
void loop() {
digitalWrite(13,LOW); delay(1000);

This is the code just make LED blink and write to serial monitor Hi. On the top right corner of IDE you have to push Play button and choose executable file where is your sketch. Than upload code to Arduino. Click on Serial Monitor on the bottom of window setup port and push button upper option button in Serial Monitor window. I you done everything correctly you will see “Hi” message every 2 seconds and blink LED on arduino.

is the code just make LED blink and write to serial monitor Hi. On the top right corner of IDE you have to push Play button and choose executable file where is your sketch. Than upload code to Arduino. Click on Serial Monitor on the bottom of window setup port and push button upper option button in Serial Monitor window. I you done everything correctly you will see “Hi” message every 2 seconds and blink LED on arduino.

Sorry for my English :)

Step 5:

1 Person Made This Project!


  • Made with Math Contest

    Made with Math Contest
  • Multi-Discipline Contest

    Multi-Discipline Contest
  • Robotics Contest

    Robotics Contest

14 Discussions


Tip 4 weeks ago

Thanks! Very helpful instructable :)

For benefit of anyone else seeing this as I was scratching my head for a while, you won't see the option to upload the sketch until you build the whole project - even though you will be able to read the serial from whatever is already flashed to Arduino.


1 year ago

hey i have a probleme when i edit the cmakelists, the error is that i can not edit a file because its not in the same project



1 year ago

Hello, and thanks for writing this informative tutorial :) I was wondering if you knew when/if the plugin will support SAM Arduino boards like the Due? These are the most powerful Arduinos, and it would be so great if the plugin supported them also. Any help you could provide on getting this support added would be super appreciated! Thank you again!


1 year ago

Thank you for this well-written tutorial. I was all excited to try it out, and was able to get it installed...only to find that it does not support the SAM Arduino boards, namely the Due. Do you know if this is planned to be supported, since it is the Arduino flag-ship board? Any help you could provide would be tremendously appreciated!


3 years ago


i have followed this instructables exactly, but when i press the green 'play' button, i got the following error message:

"C:\Program Files (x86)\JetBrains\CLion 2016.1.3\bin\cmake\bin\cmake.exe" --build C:\Users\wanek\.CLion2016.1\system\cmake\generated\uno-931e5b88\931e5b88\Debug --target upload -- -j 4

[ 89%] Built target uno_CORE

[100%] Built target uno

avrdude.exe: ser_open(): can't open device "/dev/ttyUSB0": The system cannot find the path specified.

avrdude.exe done. Thank you.

mingw32-make.exe[3]: *** [CMakeFiles/uno-upload] Error 1

CMakeFiles\uno-upload.dir\build.make:56: recipe for target 'CMakeFiles/uno-upload' failed

CMakeFiles\Makefile2:172: recipe for target 'CMakeFiles/uno-upload.dir/all' failed

CMakeFiles\Makefile2:211: recipe for target 'CMakeFiles/upload.dir/rule' failed

mingw32-make.exe[2]: *** [CMakeFiles/uno-upload.dir/all] Error 2

mingw32-make.exe[1]: *** [CMakeFiles/upload.dir/rule] Error 2

mingw32-make.exe: *** [upload] Error 2

Makefile:169: recipe for target 'upload' failed


i guess the problem is with the "/dev/ttyUSB0" parameter in the cmakelists.txt file.

this is what i have in the cmakelists.txt:

cmake_minimum_required(VERSION 2.8.4)set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/ArduinoToolchain.cmake)set(PROJECT_NAME uno)project(${PROJECT_NAME})set(${CMAKE_PROJECT_NAME}_BOARD uno)set(${CMAKE_PROJECT_NAME}_PORT /dev/ttyUSB0)set(${CMAKE_PROJECT_NAME}_SKETCH uno.ino)generate_arduino_firmware(${CMAKE_PROJECT_NAME})


i would greatly appreciate some help.


7 replies

Reply 3 years ago

Hi I will try to install on Windows asap, but now just try this, in windows you dont have

/dev/ttyUSB0 but try one of this

private static final String PORT_NAMES[] = {

"/dev/tty.usbserial-A9007UX1", // Mac OS X

"/dev/ttyACM0", // Raspberry Pi

"/dev/ttyUSB0", // Linux

"COM3", // Windows


Reply 3 years ago


thank you for the answer. indeed, the 'com3' works with windows 10. now i can upload simple sketches.

however, i have one more question: what should i set up in clion, to recognise the arduino libraries? they are marked with red in the ide, and it says: can not find 'wire.h'. when i try to upload a sketch with some libs, at compilation says:

"C:\Program Files (x86)\JetBrains\CLion 2016.1.3\bin\cmake\bin\cmake.exe" --build C:\Users\wanek\.CLion2016.1\system\cmake\generated\UNO-931ddf68\931ddf68\Debug --target upload -- -j 4

[ 86%] Built target uno_CORE

[ 89%] Built target uno_EEPROM

Scanning dependencies of target UNO

[ 93%] Building CXX object CMakeFiles/UNO.dir/UNO_UNO.ino.cpp.obj

C:/Users/wanek/ClionProjects/UNO/UNO.ino:53:63: fatal error: SPI.h: No such file or directory

#include <SPI.h> //for digipot serial interface


compilation terminated.

mingw32-make.exe[3]: *** [CMakeFiles/UNO.dir/UNO_UNO.ino.cpp.obj] Error 1

mingw32-make.exe[2]: *** [CMakeFiles/UNO.dir/all] Error 2

mingw32-make.exe[1]: *** [CMakeFiles/upload.dir/rule] Error 2

CMakeFiles\UNO.dir\build.make:65: recipe for target 'CMakeFiles/UNO.dir/UNO_UNO.ino.cpp.obj' failed

CMakeFiles\Makefile2:99: recipe for target 'CMakeFiles/UNO.dir/all' failed

CMakeFiles\Makefile2:249: recipe for target 'CMakeFiles/upload.dir/rule' failed

Makefile:182: recipe for target 'upload' failed

mingw32-make.exe: *** [upload] Error 2

thanks again for help!


Reply 3 years ago

Hi ok fast solution in Clion je have in file tree on left site External libraries open it and you will see folders Arduino library, include library, .... find one where is inside folder with EEPROM, ESplora, ..... a check where they are in disk on that place just copy library you want a refresh Clion you will able to #include new library with autocomplete


Reply 3 years ago

unfortunately this is not working for me.

i've found the esplora lib located in c:\Program Files (x86)\Arduino\libraries\.

i've moved all my libs into this folder, restarted the ide, etc. clion lists them, but they are not active. i permanently got the: 'some source files are located outside of cmakelists.txt directory. you can change the project root, or ignore this in future' warning (you can see in the attached image).


Reply 2 years ago

Hi Wanek, I don't understand the answer of Adam. Do you solved that library at CLion issue now?


Reply 2 years ago


partially i've solved the problem, but there were some libs i could not import, no matter what i try. i wrote a detailed tutorial here:

however, this was a long time ago, since then clion has new versions, and other problems arise. so, i abandoned this approach, and continued to use the original arduino ide.


Reply 2 years ago

Hi I give up on that clion plugin, but I dont want use arduio ide ... so I try platformio for uploading code and dependencies managment and for coding I use clion, platformio generate clion project for you, I will post video how to do it but in the end I have fully working auto-complete code ad connection between libraries, so you can jump where you want and use InteliJ features but need some time to make video but stay calm :)


3 years ago

Your English is great! Welcome to instructables!