Sketch does not specify the board

Looking back at some old projects, it irks me that the sketch does not indicate what board it was built for.

I've used several boards over the years, and have to admit to having been lazy in not documenting the target boards fully.

I would have thought that the sketch should set the board it was built for, not the last one specified .... ....

You get this functionality in IDE 2.x

You can install 2.x to try it out alongside 1.x They can share the same sketchbook and libraries if you want then to

1 Like

How? I have great difficulty believing that one can take a sketch from system A to a fresh IDE install of the IDE on system B and the IDE on system B will know that the sketch was written for a specific board.

Thanks, always quick to answer....

Think I tried 2.x before, but didn't know it could live alongside 1.x

I'll give it a bash and see what happens....

Presumably you've got to tell it ....

But that defeats the purpose. IDE 2.x remembers more things than IDE 1.x but it's not stored in the sketch directory.

Sometimes you able to understand this from the code... using a specific libraries... format of registers etc..
If the code doesn't has such "markers", it probably could run on any board :slight_smile:

That is not exactly what I said, although I agree that it could be read that way. The board and COM port information is associated with the sketch on my main PC, which is what I had in mind

If I save a sketch with say a Nano on COM9 selected, when I open the sketch again the same board and COM port are automatically associated with it. If I then change the board and/or COM port and save it again, close the sketch and open it again then the newly associated board and COM port are once again associated with the sketch

Clearly there is some "magic" going on behind the scenes but how and where the board and port metadata is held I don't know

I am sorry if my previous reply caused any confusion

1 Like

That works as well in IDE 1.x :wink: But from memory, IDE 2.x is more clever. If I have a sketch for a Nano and its port, close and open the IDE and after that open a sketch for a Mega with its port, they are reflected; note that I stated that this is from memory.

I did know but as I don't have IDE 2.x at the moment I'm not sure.

"If I save a sketch with say a Nano on COM9 selected, when I open the sketch again the same board and COM port are automatically associated with it. If I then change the board and/or COM port and save it again, close the sketch and open it again then the newly associated board and COM port are once again associated with the sketch".

Which means there is zero relationship between the Sketch, the board, and the COM port.

Changing the board and COM port will then be persistent to all old and new sketches opened. This doesn't make any practical sense to me ....

It's a bit like taking your car to a garage for a service, and they use the service manual for the last car they had in ...

Rubbish

The point is that when you save a sketch the board and port current at the time of saving are remembered when you open the sketch again

No, it is more like taking your car to a garage for a service and they use the service manual from the last time that the car was in for service

None of this is true ....

@daba this is not a very productive way to participate in a technical discussion with people who are trying to provide free assistance. Please try to act in a more polite and professional manner. You are welcome to dispute the claims of others, but if you want to do that then specify exactly what it is you think is incorrect and provide evidence to back up what you say.

Which version of Arduino IDE are you using (e.g., "2.3.2")? The version is shown on the window title bar and also in the dialog that opens when you select Help > About (or Arduino IDE > About Arduino IDE for macOS users) from the Arduino IDE menus. The feature @UKHeliBob is referring to is specific to Arduino IDE 2.x.

I understand your comments, and apologise for being terse, however, I find the feedback I have received to be inconsistent with my experiences.

I am using IDE 1.8.19,k and what I have found is that once I "set" a board on any project I have open, (and the COM port is irrelevant, as that may change depending on the physical connection), that setting persists, no matter what sketch I open.

Simply put, your "board" choice is set in the IDE, and no matter what sketch you open, or re-open, that board remains as the current board, even if it is not the board the sketch was written for...

Of course, the work-around is to document in the sketch the target board for the sketch, but you will still manually have to read that info, and change the "board" setting to suit the open project.

I feel this could be more automated, the INO file specifying the board, and the IDE changing it according to the INO

Your wishes are, to say the least, late. This is an old version and no one will fix it since a 2.x has already been released

I will try 2.x to see if the situation is resolved, but from what was said earlier, I don't think it has....

That depends on your exact requirement. All I can say is that using IDE 2.3.2 saving a sketch with a board and COM port defined means that when the sketch is opened again on the same PC the board and COM port is set to that active at the time of saving

This is using Windows 10

I have no experience of using the IDE to any extent on any other OS

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.