Unable to open multiple sessions on the same sketch

I want to be able to upload and serial-monitor several arduino's running the same sketch.
If I open a second instance of the IDE, if I switch it to the same sketch opened on another IDE, it takes me to the other IDE rather than letting me have two. Most frustrating.

1 Like

If we assume Windows, did you open a NEW window and then start the second IDE?
Paul

Hi @StephenJD. If you would like to bring this to the attention of the developers you can submit an issue on the Arduino IDE 2.x repository here:
https://github.com/arduino/arduino-ide/issues/new?labels=type%3A+enhancement&template=feature_request.md

You should always do a search of the existing issues before making a new one to avoid duplicates, However, I just did some searching and didn't find anything about this particular subject.

1 Like

@StephenJD's issue report:

Thanks!

For monitoring serial ports, use a serial terminal application like Putty or Tera Term. The serial monitor in the IDE is basically just a simple educational tool.

Also please answer the question in reply #2.

I suspect reply 2 was based on how the classic Arduino IDE works.

The classic Arduino IDE has two distinct behaviors based on how the window was created:

If multiple windows of the same instance are created via the IDE menus (i.e., File > New, File > Open..., , File > Open Recent, File > Sketchbook, File > Examples), then each window shares the same board and port selection and the same Serial Monitor.

If multiple instances of the IDE are created by opening the IDE multiple times, either by running the IDE executable directly, or by opening a sketch file directly, then each instance has its own independent board, port, and Serial Monitor.

In Arduino IDE 2.x, each window is an independent instance no matter how it was created. So each window has its own board, port, and serial monitor selection. You can't start the Arduino IDE twice. So the question in reply 2 doesn't really make sense in the context of how Arduino IDE 2.x works.

Arduino IDE 2.x has the same behavior as VS Code in that if you try to open a folder or workspace again in a new window, it just switches you to the existing window that already has that folder or workspace open. It is possible to duplicate the workspace in VS Code via the "Workspaces: Duplicate As Workspace in New Window" command, but I don't see an equivalent in Arduino IDE 2.x (likely because the underlying Eclipse Theia IDE framework doesn't provide it).

Yes.
Paul

I cannot find a way of opening two windows on the same sketch. File->open reverts to the existing instance. If I dbl-click on the same sketch in explorer, it opens the original IDE. V1.8 of the IDE allows multiple windows on the same sketch.

No wonder, think of the synchronization issues that could arise.

Synchronisation is not a problem. The IDE reads and uploads any modified file before compiling it. I've been doing this for years with no problems.

But you could make changes to one window, leave and make changes to the second window, compile and the changes made to the first one would be lost.

Or, make changes to a first window, compile and decide it's not working, open the second window and fix the changes, compile and close. Later, see the unsaved first window... oops I forget to save it. Now I've overwritten the fixed sketch with the bad one... The Arduino has a working sketch but the original file is lost.

Indeed you could. You could jump in front of a bus and get run over.
C/C++ does not claim to offer protection to those intent on self-destruction, it does, however seek to make useful things possible.
It is very useful, when developing sketches to be able to test them on multiple boards, or to write a shetch that allow boards to talk to each other. In both scenarios you want the same sketch on multiple ports.
I can do this using IDE 1.8. Why not on IDE 2.0?

You are missing the point. You are speaking like a developer. Most of the people using the IDE are beginners. They don't need this feature, and there is a good possibility it could lead them to confusion and/or data loss because they don't understand or expect this behaviour.

In fact, most desktops apps prohibit this behaviour. If you open a spreadsheet in LibreOffice, and then open it again in another invocation of LibreOffice, it does not open the file, instead it changes focus to the already open document. It does this because it is the safe thing to do, it avoids setting the user up for taking actions that are unintended, without any warning.

I'm pretty sure this is normal, accepted behaviour for any app that opens files in write mode in a GUI.

The analogy of C/C++ flexibility is a huge stretch, it's not comparable.

@Stephenjd you can split the editor:
F1 (command line) -- > View: split editor or Ctrl+\

On Windows 11 Professional you should be able to satisfy your wants by using VM(s):
https://www.clonefileschecker.com/blog/how-to-try-windows-11-inside-a-virtual-machine-without-affecting-your-real-machine/

I have a couple of W11 units, but have not yet configured them for VMs. But on my primary dev box, I have W10 Pro configured and run Linux easily alongside W10 apps, all with 8G RAM.

Thanks. Yes that works, but it's a pretty heavy weight solution for something that worked fine in Arduino 1.8 but is no longer possible on Arduino 2.0. Surely an option could be provided to allow this on 2.0?

Get TypeApp for Android

That is a handy feature, but can you connect each tab to a different serial port? I don't think so.

I'm aiming at the title of your post "unable to open multiple sessions on the same sketch:"

the proposed scheme.

If you want to open multiple tabs in a sketch and connect different serial ports at the same time, it is certainly impossible in principle.

Because a sketch can only target one serial port, and different sketches can correspond to different serial ports

Since the discussion has become active again, I'll share an update to my previous statement:

There was a regression in the 2.0.0-rc1 release of the IDE that causes the Serial Monitor and Serial Plotters of all IDE windows to use the same ports:

So my previous statement only applies to 2.0.0-beta.12 and earlier. Hopefully the issue will be resolved in an upcoming release of the Arduino IDE.

Actually, the VM services underpinnings are not heavy-weight, W10/W11 has all the framework scaffolding already in place, just activate the feature.