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
  • I don't think you will be able to do that with the Arduino IDE. You may have more luck with a Makefile-based workflow. Commented Jul 9, 2017 at 8:04
  • You can do it in UECIDE...
    – Majenko
    Commented Jul 9, 2017 at 8:48

2 Answers 2

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

8
  • Tried to install it in Linux, but update fails: GPG error: majenko.co.uk/debian stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8386A4D0CA9F00A1
    – user31481
    Commented Jul 9, 2017 at 9:52
  • You have to install "majenko-keyring" first from the same repository. It adds the public key for you.
    – Majenko
    Commented Jul 9, 2017 at 9:52
  • Or you can manually download the public key and add it with apt-key add: majenko.co.uk/debian/key.asc
    – Majenko
    Commented Jul 9, 2017 at 9:55
  • Just following the script: First, update. Update failed. So, next install also failed: "Unable to locate package majenko-keyring".
    – user31481
    Commented Jul 9, 2017 at 9:56
  • Darn, looks like I only had that package in unstable. Just backported it to stable.
    – Majenko
    Commented Jul 9, 2017 at 9:59
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.