Possible to retrieve code from Arduino?

I am pretty sure the answer is no, but I still have to ask:

Is there a way to retrieve or download the sketch from a working Arduino?

I have a working project, but have been away from it for 18 months or so, and I can't find the sketch it is programmed with to now make some modifications. The thought of starting over seems daunting. I suspect that since the programming is compiled binary on the Arduino that there is no way to to get it back into a IDE sketch that I would recognize, but hey, I can't be the only person that has wondered right?

Cheers!

I am pretty sure the answer is no

You are right. And wrong. Right in the sense that what is uploaded to the Arduino is not what you see in the IDE. It is a hex file produced by the compiler and linker.

You are wrong in that that hex file can be retrieved. Doing so will not prove very useful, though.

Think of the compiler and linker as a shredder. The shredded material can not be run through in the other direction, with the expectation that a whole piece of paper will come out.

I can't be the only person that has wondered right?

You aren't, which proves that you didn't look for an answer.

I second this answer.

Time to learn about backups and version control (e.g. GIT: http://git-scm.com/).

Thanks for the responses.

LET THE REWRITES BEGIN!

It will be better the second time right?

Cheers!

In a prior thread where this was discussed, it was pointed out that the IDE generates a source file that is then compiled - it contains a main function to make it an acceptable C++ program. That intermediate file gets left behind on disk somewhere if you can find it. I assume though that if this would do you any good, you would likely have access to the original sketch on the computer it was compiled on.

cobblestone:
Thanks for the responses.

LET THE REWRITES BEGIN!

It will be better the second time right?

Cheers!

In Windows Vista/7 if you right click the sketches folder you can access "previous versions" of the files, so you can recover your files even if you deleted them.