What's Running Now?

Is there a way to download to the PC the program that is currently running on the Arduino?

As in: if you are playing around with different versions of a sketch, take a break, and can't remember which sketch is currently loaded, is there a way to find out other than running it and seeing what happens and comparing?

Thanks, JohnnyMc Newbie

I think theoretically AVRDUDE could be used to download the contents of the flash memory to the PC as a .hex file. hen that file would need to be compared to the .hex files from various suspect sketches. Tedious at best, including finding where the Arduino IDE hides the .hex files. I'd probably go with Post-It (c) notes or something :)

Is there a way to download to the PC the program that is currently running on the Arduino?

You could get the HEX data from the chip, but you would not be able to convert that back to the original C.

ncluding finding where the Arduino IDE hides the .hex files.

The real issue is that the IDE deletes the HEX after upload. If you hold-shift while clicking verify / upload, the IDE will save the HEX and tell you where it is located.

Not tried but you could declare a string in PROGMEM with e.g. "appname 0.11". When viewing the hex file you might recognize it.

Or would it be optimized away by the compiler if not used?

==> do a serial.println(appname) in setup() then the string is used, and when the board is started the Arduino would tell you what is loaded

Still that won't work for older sketches or from som 3rd party...

Or would it be optimized away by the compiler if not used?

I don't think it would get optimized out. If you calculate at run-time the memory location to be used, how would the complier know which parts of PROGMEM are unnecessary?

The addition of the Serial.print() seems like a good practice, in sketches that can or already use Serial().

Thanks for all the replies, but most of that is over my head just yet. Also doesn't sound like you can do what I was thinking. Thanks anyway!

John