Why would you have multiple bare arduinos with different programs on them? I have some that are actually in robots and sometimes another one I use to test out things that just use the serial monitor, but I never have two arduinos not attached to anything that I'm using at the same time.
KrazeyNKrusty:
All my Arduino look the same, so when I pick one up off my workbench I don't know which sketch is loaded on it.
I think in the future, I will start each sketch by printing some identifying info to the serial port.
Is this how other people approach it?
Yes I often do that. I also sometimes have a 'press any key to run' type waiting function in the setup function so as to not start running the main sketch until I want it to, such as allowing me to get the serial monitor running or other things I might want to do manually before the sketch starts running the main loop function.
Does the Arduino compiler waste AVR memory by storing that data when it uploads a sketch?
No, those are compiler constants and don't take up any more memory than the (probably) thousands of #defines in gcc. They will only take up memory if you use them - and even then they probably go into flash.
I prefer to just reprogram every time I want to do anything, it only takes a second ,and you might as well if you're opening up the IDE to serial monitor anyway. That way I know I'm working with the code I want and the most recent version etc.
Just out of curiosity - does that mean that the code that gave rise to my question Serial.println(__FILE__); won't work? or does it mean that if I included that code in a sketch the compiler would then upload the data as part of the sketch?
...R
KeithRB:
Does the Arduino compiler waste AVR memory by storing that data when it uploads a sketch?
No, those are compiler constants and don't take up any more memory than the (probably) thousands of #defines in gcc. They will only take up memory if you use them - and even then they probably go into flash.
They are pre-defined macros, they will be treated like any #define you don't use. If you need it, it is treated as a compile time constant and loaded from PROGMEM, if you don't use it, it is ignored.
I am sure a quick sketch with a glance at the assembler output will clear it up.