Connecting two Arduinos (Megas) to one laptop?

Is there a method for connecting two Megas to a laptop. If I try, all copies of the IDE seem to be able to connect to one Comm (USB) port at a time.

I am trying to debug some simple (so I thought) Ethernet/UDP apps. One Send; one receive. By connecting one Mega to the laptop/IDE and the other to a battery, I can upload and run sketches. But I can only see console output from one micro.

If I could see BOTH debug statements together, it would help.

In case you might see the problem, I've attached to code in question. The receive/console never sees any data.

TII-Interact_commsTest_Send.ino (2.6 KB)

TII-Interact_commsTest_Console.ino (2.24 KB)

Is there a method for connecting two Megas to a laptop. If I try, all copies of the IDE seem to be able to connect to one Comm (USB) port at a time.

It's a pain isn't it? As far as I know it's a limitation of the IDE. If someone here knows otherwise then, like you, I'd love to know.

It's a matter of the right PC application. Either two terminal programs which connect to their Arduinos, or a program that can connect to a number (2+) of COM ports. Choose a programming language that can deal with sequential files, open a COM file for each Arduino, add a console or text window to each file and start logging.

I also have an old Arduino 1.05 on my PC as a separate application .
I can run the latest and this old one at the same time , have two serial monitors etc .

Use a terminal program such as PuTTY or RealTerm for the second Arduino.

I don't use the Arduino IDE for editing but I have been under the impression that if you launch it twice as two separate programs they will be independent of each other.

...R

PerryBebbington:
It's a pain isn't it? As far as I know it's a limitation of the IDE. If someone here knows otherwise then, like you, I'd love to know.

Actually, it is quite easy. I opened two instances of the IDE in separate windows(win 10) to test Robins programs for the TX/RX RF communications. Both windows side-by-side on the screen of my laptop. Both programs displayed the text at the same time.

Both instances used the USB ports of the laptop, but had different serial ports logically assigned.

Paul

Thanks Paul,
I hesitated before posting that as I know I've had some problems with 2 devices at the same time but could not quite remember if it was this or something else :o

Resolved!!!

Paul_KD7HB had it. Several others came close. Someone communicated with me off-board (I don't know why) and basically described what Paul said.

I was used to opening sketches from the first instance of the IDE. In that case, any attempts are futile.

You need to open separate, multiple instances of the IDE from the OS. Menu or shortcut. Just do NOT use File | Open within the IDE.

If you do this, open separate instances, then you can assign unique ports to each instance. And everything is copacetic.

Thank you djsfantasi!

I didn't know they were different, thanks for letting me and everyone else know :slight_smile:
++Karma;

Way back I've run I think three boards connected to a USB hub at the same time, with the hub connected to the windows pc USB port. Each board will get it's own serial port. Open a separate IDE instance of the board for each board. when you open the serial monitor you may need to select the correct serial port for the board.

Thanks everyone.

“Open a separate IDE instance” is the solution I was looking for.

The confusing part is that after opening a separate window, it’s not necessarily a separate instance. You need to start the IDE from the menu. Do NOT use file open.

The embarrassing thing is that I knew that. However, my preconception that a separate window == separate instance bit me in my glutes.

Thanks everyone.

I do this all the time Arduinos+Teensy, Teensy+ESP8266.

Here's how

  1. Use Start menu to fire up Arduino IDE, open desired program set appropriate port
  2. Use Start menu again to fire up another Arduino IDE, in this instance, open desired program and close what ever it opened automatically, set appropriate port (DO NOT simply open another program from from the first instance.

I'll then arrange IDE1_serial for IDE 1 on one have of the screen, IDE2, Serial for IDE 2 for the other half.

Hope this helps.