Automated start/stop of serial monitor

I’m developing ESP8266 based IOT solutions for quite a while, first on Arduino IDE, later on Eclipse + Sloeber. I finally learnt that Clion + PlatformIO is a much better platform for such things in many aspects and I’m happy to have switched to that.

But there is one thing that bothers me: Arduino IDE as well es Eclipse/Sloeber provided an automated solution that after uploading the firmware the serial monitor starts automatically (and stops before uploading to avoid access conflicts). I googled a lot, but I’ve found nothing to use for Clion. To make it clear, the PlatformIO plugin and the serial monitor with all the nice filter features work well, it’s just about avoiding the clicks to manually start/stop the monitor.

Does anybody have an idea?

Many thanks in advance, Thomas

I have the same issue. When I’ve stumbled upon this for the first time, I think I managed to find the issue on the CLion issue tracker – so they should be aware of the problem.

To sum up: yea – if you have CLion’s serial monitor open, you cannot upload the code and vice versa.

The best solution I came up with was not to upload/monitor via CLion directly. I just use the built in Terminal and PIO:

pio run -e nodemcu -t upload -t monitor

When I need to (re)upload, I ctrl+c to stop the monitor, and run the command again.

One more workaround: at some point, you may want to “install” the uC somewhere in your house and upload the firmware via WiFi. Then, the “serial” monitor will not work anyway.

I’m using GitHub - ayushsharma82/WebSerial: Remote Serial monitor for ESP8266 & ESP32 – for a “web” serial – so it is just a web browser window open all the time.

lib_deps =
    ayushsharma82/WebSerial @ ^1.3.0

And then the upload directly via “Run” button in CLion works as expected, without the “conflict” with the Serial Monitor, ofc.

Thank you uvery much. The WebSerial solution seems to be a clever workaround, especially as I already use the web server in my apps. Nevertheless, I was hoping that there is some kind of solution to be integrated in the IDE, to be able to read all outputs, even before starting the web server. For me the combination Clion/PlatformIO is the best overall solution for µC software development. It is hard for me to understand why is there no solution for that quite common problem.

Someone has to do it. I guess not so many people are using PIO+CLion. Problems do exist and are not being fixed for a looooooong time. PIO is an open source project with a few people actually working on it. CLion is a paid IDE, but I guess we are also too few, to encourage Jetbrains to take our issues seriously ;p

PlatformIO is definitvely a good thing, in my eyes better as Arduino and Sloeber. And the JetBrains IDE’s are the best out there, also in my eyes. I use IntelliJ IDEA for Java in business, so I love Clion as it follows the same principles.

Anyhow, I think there is a solution in the CMake universe, it is a powerful tool. Unfortunately, I’m not acquainted with it and it seems to be not too easy to understand its principles of working in detail.

Recently the new CLion was released with PlatformIO plugin completely rewritten.
There is “Upload and Monitor” task now in the dedicated PlatformIO tool window.

A blog post:

CLion documentation:

Just noting that I’m having the same issue with VSCode and PlatformIO. I opened an issue on GitHub as well: "Upload & Monitor" Failing but "Upload" then "Monitor" works · Issue #3809 · platformio/platformio-vscode-ide · GitHub