Client/Server development

When You power up the Pc, You need to click the Arduino icon to start IDE number one.
Then click again on the Arduino icon! IDE number 2 will now get started. Don't use "file open" like You did.

Thanks, I never tried it before, but it works! Simple and helpful!

Bingo! Nice it works. There is a button to click on, for the reply that pulled the plug.

1 Like

What version of the IDE are you using?

Regards-- Ray Leiter

@RayL. a valid question :wink:

  • It worked with two instances of 1.8.15 on my Win10 PC ...
  • It worked with two instances of 1.8.19 on my Laptop
  • It did not work with 2.0.0-rc3 (on the Win10 PC)
    (I could open a second instance as admin, but that did not gain access to the COM ports)

In both successful cases I connected an UNO to one instance and an ESP32 to the other and was able to communicate with both via COM "in parallel" (as parallel as one may punch in some commands in the terminals).

Did you think of installing the second IDE in a virtual machine? I haven't tried that but it may be a workaround ...

P.S.: To be quite clear: I was able to open two instances by clicking the desktop icon that refers to "C:\Program Files (x86)\Arduino\arduino.exe"!
P.P.S.: We are talking MS Windows ... You never know how clever the Start Menu is ... When you rightclick on the Arduino icon under Start it opens with a list of the "last used" files. Who outside Redmond knows what's going on then ... :wink:

I'd leave this to the TO ... ;-)) ... But will honor your post with a "heart"!

Haha. Too quick this time, not OP that replied.

But there is a realistic chance you solved it ... :wink:

Just to be clear, I don't have a good workable solution to this issue of debugging 2 Arduino boards, each with it's own COM port for program transfer and debugging output and each board being under the control of its own IDE.
One of the problems we have with folks trying to help with this issue is the lack of precise information. e.g. often the prospective help will NOT indicate which version of the IDE they used when they accomplished something they believe is helpful.
But that is only part of the problem. In addition to omitting critical information, the prospective helper also often uses terminology which is sometime ambiguous or misleading. e.g. people will often say I need to make sure I load an "instance" of the IDE for each board and NOT just have 1 "instance" with 2 windows. They then go on to say "click the icon again that you used to launch the 1st "instance". Also, they don't necessarily tell you what version of Windows they used for their test.
First of all, the term "instance" is NOT meaningful in the Windows environment when using Task Manager to "see" how many "instances" you have running. The appropriate term is either "Application" or "process" and they are not necessarily the same thing. e.g. using version 2.0.0-rc3, if you launch the IDE by clicking on the icon on the desktop or the Start menu and then use the Task Manager to "view" what is running in memory, you will probably see 1 application (APP) and anywhere from around 6 to 17 processes associated with that single App (the IDE).
What I'm talking about here is NOT simply quibbling about what terms are used by rather I have found over the years that use of the appropriate terms greatly aids in understanding.
In my experiment with this issue, I have used the Task Manger to see what IDE(s) were running as I have used the various methods to launch another 'copy' of the IDE to support the additional board I am working with. I don't understand what I see when I view the programs running (using Task Manager) and part of the problem is it's not always the same! You may wish to explore some of what I talking about here to see if you might be able to figure it all out and thereby provide some insight into this issue of 2 IDE, each with its own port for program transfer and debug.
So far, I believe this is what I have found: Since I need the serial port available to my client in order to send data to my server, I make sure, after 'uploading' the sketch, that port is available to the client by clicking on the icon within the IDE to open the Serial Monitor. However, I must NOT try to use the Serial Monitor on the server after I have uploaded the sketch to the server board.
If I do, then the client gets disconnected, which means I can't use it to send data to the server.
Basically, I only have available to me, the Serial Monitor on the client for debugging.
I am currently thinking about using Software Serial to get around this. I was thinking of using one of the Serial-TTL cables commonly used for debug and have a terminal program read the serial port that get established when I plug in the Serial-TTL cable. The other end of this cable typically has at least 4 pins so it can be used with data transfer and perhaps flow-control. I don't really care about flow-control -- I'd be happy just to get some data!
I know that's a lot to cogitate upon, but if you have any thoughts on the matter, please share.
Ray

I program my chips via an Raspi and avrdude. Practically i ssh into my raspi which is my development environment - I edit (vim), compile and flash (avrdude) sketches to any chip which is connected. Vim is a little bit confusing at the beginning but one will get into it pretty quickly.

Debugging of multiple chips using serial is also no problem since they are connected to my raspi anyways.

Paul B;
Have you tried to run " two instances of the IDE" in version 2 of the IDE or did you use one of the variations of version 1?

I'm not sure I even know how to get " two windows in the same IDE".

Is this easy to do and with which version 1 or 2?

I understand your approach. I suppose you use ssh because you don't want another keyboard on your desktop?
Is your ssh client on PC like a Windows machine or perhaps a MAC?
I might look into that approach.
I have used vim quite a bit over the years, before that I used vi.

I'm currently thinking about using software serial on one of the machines.
In my current situation it would be the server since all it has to do is "output" info and not input anything, while the client needs the serial for both in and out.
I suppose there is no reason why it couldn't be reversed?

I suppose you use ssh because you don't want another keyboard on your desktop?

I have the Raspi Zero with no GUI. So my playground is the shell which i access over SSH. At the beginning there is for sure some command googling for the shell, but it became second nature alreadys after a few days. For sure there are edge cases and you please ms. google from time to time, you never know everything right... For me working in the shell is quick, reliable, puristic and nostalgic as f*** Highly recommend it :smiley:

Is your ssh client on PC like a Windows machine or perhaps a MAC?

Yea, i am using a windows machine. I am not even using any special ssh tool like putty - just a couple of cmd windows - vim and debug/serial output for each avr i need to work with in parallel - works just fine.

I might look into that approach.

Sure go for it! Even though i dont have any setup experience with it, you actually wont even need an raspi and do it on your machine directly (like now but without the "stupid" arduino ide and vim instead). Which means you wont even need SSH. Just a cmd/shell tool for flashing and debugging output over serial. I use the package "minicom" for serial connections from pi to atmega/attiny, but there are dozens, for every platform)

If you decide to give it a try, feel free to open a thread within this forum and let me know - i would be very happy to help you figure setup and stuff out!

I'm currently thinking about using software serial on one of the machines.

Which is completely sufficient

In my current situation it would be the server since all it has to do is "output" info and not input anything, while the client needs the serial for both in and out.

Yeah, sounds plausible. You could probably also use the regular Serial Interface (rx/tx) instead of the SoftwareSerial. They are both no-brainer in setup/usage. My actual recommendation would be I2C, but this is a bit more work to set up...

I suppose there is no reason why it couldn't be reversed?

This depends from project to project, there will be for sure reasonable use cases.

Cheers!

You are right, but I think this is a media problem: It is hard to get on the same knowledge level just by some "chatlike" inputs without real personal interaction ... Not to talk about different personal experience, knowledge, language and terminology .. :wink:

What I find if I call the IDE arduino.exe (in this case 1.18.15) two times is two (what I call for a lack of better wording) "instances" of Java. They appear in two different windows. If I open a second sketch from one of the "instances" there are still two Java instances but one of them covers two visible applications:
image

I have choosen different boards for the two instances and can let them compile in parallel!
If I start a compilation in one window of the instance with two different windows, I cannot start the compilation in parallel in the second window.

Would you consider this as a proof for two independent instances of one program?

P.S.: And it is Windows 10

Yes, I would.

You have done a good job of making my point about the discussion back and forth and all the attendant confusion simply because we often don’t begin our discussions with a clear explanation of our environments (like the version of the software we are talking about).

Much of the discussion (and confusion) I’ve had about this issue of “how to load 2 ‘instances’ of the IDE” happened because we don’t always begin by stating what version of the IDE we are describing.

Putting all that to rest for awhile – I’d like to tell you what I have done to allow me to have 2 IDEs running where each one has its own board to download code to and how I managed to allow each IDE to use Serial output for debugging information for me to look at.

First, I am using Version 2.0.0-rc3 of the IDE.

Second, I CAN’T load the second copy of the IDE by clicking on the icon I use to load the first IDE (It WON’T work.) To load a second copy, I MUST use File->Open from the first IDE or one of it’s variations like File->Open Recent.

Thirdly, and perhaps the most important, I can only use the Serial Monitor in ONE of the 2 IDEs I’m running to get debugging info. I can get debugging info from the other IDE by using SoftwareSerial instead of the built in hardware serial.

All I need is 1 pin available to me on the MCU I wish to use SoftwareSerial on.

I use a preprocessor macro I wrote which allows me to write “dbg(sometext);” instead of “Serial.println(sometext)”.

I’m working on an implementation that allows me to avoid most of the code I would normally need to explicitly write such as the “#include <SoftwareSerial.h>” and the instantiation of the object such as “SoftwareSerial mySerial;” and the “mySerial.begin(baud);”.

I’m looking into whether I want to develop a class or just rely on “#include” and what may go with it.

The class approach would be better. It would look like this: (assuming the class is called “Dbg”)

#include <Dbg.h>

Dbg dbg(baud, TxPin);

And to use it, I’d write: Dbg.dbg(sometext); OR just dbug(sometext); (assuming I write a macro called “dbug”.

I can make it work easily because I have one of the so-called Serial Debugging cables I plug into one of USB ports on my development system. As you know the USB end of the cable has a USB to Serial-TTL converter chip enclosed in a plastic case which also hold the USB connector as well.

To monitor the virtual com port that gets setup by inserting the cable into a USB port, I use a terminal program.

That gives me 3 windows (2 for IDEs and 1 for the terminal program).

It works well and so far I have written the code explicitly i.e. I’m not using any classes or special #include(s).

Regards-- Ray Leiter

Thanks Ray for the comprehensive explanations (it shows how much text is really needed which is a real lack of these media) ...

I can exactly second your findings about the 2.0.0 IDE. This is what I got once when starting it on Windows 10 PC with just one sketch (2 files: .ino and .h) preloaded:

image

However

  1. it was not possible to start a second instance (as possible with 1.8.15 before)
  2. After closing and starting the IDE I even got up to 18 (let's call it ) "tasks" incl. a Command Window, ardunio-cli-compiler, and so on. Some are understandable but several do not easily disclose their purpose and necessity ...

And I also experienced that if I opened a second file from one (e.g. 1.8.15) instance, the serial monitors are somehow connected which did not happen, when I opened a second instance.

As 2.0.0 seems not to allow multiple instances to be used, it will obviously share the COM restriction.

I understand that you are using a Serial Debug Cable that converts TTL to USB (like the famous "FTDI" product does). That is of course a valid solution to have several connections to one board (and can obviously not be solved by a virtual machine :wink: ). But the VM may be a solution to have two IDE 2.0.0 running on the same PC being connected to two different boards in parallel ... Haven't tried it, but it sounds quite likely to work. But that seems not to be your application (at the moment at least).

I sometimes use Putty for a separate COM but also TCP with some of my ESP32 applications. The beauty of TCP is of course, that I can connect to the same board via WiFi in parallel ... As Serial is a stream, one can redirect inputs and outputs easily to a TCP client, but that requires a board with WiFi of course.

Good luck with your Dbg project! Would be nice to hear from you how you decided to go forward and about the progress you achieved. Sounds interesting!

Regards

ec2021

Thanks for this email – it has good info for me!

I have to give some thought to your idea of using a VM.

The VM approach is something I have an interest in pursuing but now I’m OK with the Debug cable.

I will certainly keep you informed on my progress as it seems you are really interested.

What is your thinking on having BOTH versions of the IDE installed so you could pick the one you want? The 2 versions would be 1.8.19 and 2.0.0-rc3 (as of this moment).

Do you think both versions can co-exist on the same PC without any conflict as long as they are installed in different directories?

Also, I have some questions about the IDE. I don’t want to overburden you with my quest for info, but I’ll just ask this one question for now:

As you know, a “#include” directive can be coded as either;

#include <file.h>” OR “#include “file.h”.

i.e. with quotes or with angle brackets!

My question is this: Exactly what is the compiler search order when trying to locate an include file?

Part of the answer to this question revolves around the issue of whether the include file is given to the compiler in quotes or angle brackets.

Just to be clear – what I am NOT asking is “when or how do I know which to use”. I am ONLY asking in what directories AND in what order, the compiler searches for the include file!

Regards-- Ray Leiter

Let's start with this: I have 1.8.15 and 2.0.0 co-existing under Win10 on my PC. They work independently (compilation in parallel, COMs parallel e.g COM9 to UNO ad COM10 to ESP32)

They have been installed as follows:

1.8.15 in the directory "C:\Program Files (x86)\Arduino"
2.0.0 in the directory "C:\Program Files\Arduino IDE"

I have not updated my PC to 1.8.19 (but only my laptop computer) as I am afraid that this might interfere with some older libs ... I am missing a tool to administrate sketches in relation to certain libraries (sometimes - but rarely - updates seem to be not completly backward compatible).

I must admit that I am more experienced with "Pascal" (Delphi and Lazarus/Free Pascal) then C++. That was a good reason to get a book about C++ last year's Christmas :wink:

The book says:

If you use #include in general the search will take place in the "include directory of the compiler or in a directory specified at a different place" (yes, exactly as clear as this wording is :innocent: ) It says on UNIX or macOS you'll find it usually as /usr/include or /usr/local/include.

For own (local) header files #include "header.h" , with relative paths #include "./../../header.h" or with an absolute path "/home/user/header.h" is used.

I found this

Source: https://docs.arduino.cc/software/ide-v1/tutorials/installing-libraries

(Just scroll all the way down to the end of that page).

Hope that helps ... :wink:

Yes, it does – thanks.

Regards-- Ray Leiter