How to set port and board in code?


I’m working in paralel with two boards on different ports.
Is it possible to set port/board in code so I don’t have to select it manually wia Tools menu when I’m loading skecth for different board?

It may be just me but i'm not quite clear on what your asking.

Are you looking for a way to have sketches loaded onto multiple boards at the same time? Or are you wanting to have multiple boards plugged into the PC then have the code in the sketch point to which board its suppose to be loaded too? cause that isn't possible.

I have found a way to do that. You have to load separate instances of Arduino IDE, not just two sekctes from the same instnce. Then for each cketch board and port settings stay constant. But ideal way would be to just write in code something like

define board=[id from boards file]

define port=15

Hope this could be implemented in new version.

I doubt that will be added. Anything added to the sketch window is for and will go to the arduino. The IDE software doesn't read it short of verifying the sketch. Also to implement a setting where you can assign an instance of the IDE to a particular bouard, they would have to update the arduino to all have a unique or multiple ID #s that could be jumper selectable.