1

I'm testing three different Arduino (nano, Uno and Mega) each of them having a nRF module. The codes (sketches) are different for each module.
I've connected the arduinos to my single laptop via 3 USB ports.

Problem is, whenever I want to re-upload a sketch and fix a bug, I have to choose board model and port number of that sketch by using the menus. It has become frustrating using mouse each time I need to change something.
How can I set these parameters in code so each sketch knows which port and model it is related to?

2 Answers2

2

You can't in the Arduino IDE, it's not designed that way (you can't even have different board/port settings in different windows - it's stored in the Java equivalent of a single global).

Instead you will have to switch to a different programming environment.

Personally (since I am the author) I would suggest switching to UECIDE. That has far more advanced facilities than the Arduino IDE, yet still retains most of the simplicity of use.

In UECIDE you can not only have different ports and boards selected in different windows, you can also configure individual sketches to automatically select their board and port.

  • Sketch -> Sketch Properties... -> Objects tab

    enter image description here

Majenko
  • 105,851
  • 5
  • 82
  • 139
0

Take a look at the (similar) question and answer in https://arduino.stackexchange.com/a/9182/22924

It talks about multiple UNOs, but the solution should help here.

John Burger
  • 1,885
  • 1
  • 14
  • 23