Save board selection with sketch?

Is it possible to save or specify the board selection with the sketch?

I am working on a project that uses multiples of UNOs, Megas, Nanos and/or Pro Minis. When I load the sketch the IDE maintains the last board selected, not the board the project was saved as. How do I get the sketch (IDE) to recall the correct board?

(deleted)

I was afraid of that. Serious :frowning:

It would be OK if there was a "directive" that could be used. It would be better if it was saved as part of the *.ino file. Some boards have multiple processors (see Pro Mini).

What about another compiler? Someone has been trying to convince me to change to Eclipse?

This feature has been much requested. There is currently a proposal to make it happen that did meet some favor but it seems to be more of a framework rather than a complete implementation and the author has said they don't have the skills to make it meet the requirements so I suspect it will not end up going anywhere unless another community member gets involved:

The Arduino Web Editor does already have this feature.

Allow me to repeat. Serious :frowning: Especially considering they put it in the web editor.

I don't know what is in the *.ino file. But I can't see that it is that big of a change. On load, read the *.ino, extract the selection set the menu bar. On save, store the menu selection in the *.ino file.

Can the *.ino file be used for any other purpose than for the Arduino IDE? (ie., is there another application or compiler that can use it)

adwsystems:
I don't know what is in the *.ino file.

It's just a text file that contains your sketch code. There's no hidden magic.

adwsystems:
But I can't see that it is that big of a change.

Then please submit a pull request. You would probably want to follow the approved convention established by Board autoswitch by timkoers · Pull Request #7349 · arduino/Arduino · GitHub but with the missing requirement of command line tool support (rather than being baked into the Arduino IDE code):
Autoselection of device · Issue #1481 · arduino/Arduino · GitHub
I think it will have a very good chance of being accepted.

As the saying goes: "Be the change you wish to see in the world".

adwsystems:
Can the *.ino file be used for any other purpose than for the Arduino IDE? (ie., is there another application or compiler that can use it)

Sure. There are all sorts of alternatives to the Arduino IDE: PlatformIO, CodeBender, Atmel Studio with the Visual Micro plugin, Eclipse with the Sloeber plugin, Visuino, Ardublock, Andruino, etc.

I haven't worked with github in the fashion. (guess I'm a GitHub noob in that regard). It looks like this is request already in progress. How can I add my name to the list of parties interested in seeing this happen. pull/7349 looks like it is well underway. I added a comment to Autoselection of device · Issue #1481 · arduino/Arduino · GitHub in case that is the correct place to "vote" to include this feature.