Let's say I uploaded a 'very valuable' sketch to my Arduino Uno and then, I lost/deleted it from my computer. Is it possible to recoup that code from the board? Thank you.
Is it possible to recoup that code from the board?
Yes, and no.
The compiler shredded your code to create an object file.
The linker mangled it, and some others, some more to create a hex file.
The uploader loaded the hex file to the Arduino.
You can recover that hex file.
You can not make eggs out of that omelet, though.
Thanks PaulS. You made me hungry! Could you give the recipe to get that hex file? Thanks again.
I remember having to do something like this back in college. You can user avrdude to recover the hex, convert the hex to assembly ewww using the datasheet for the 328p, you then may be able to get the assembly into something that looks like C. If you are familiar with the original code (since you wrote it I would hope so). This should provide you with enough information to either reconstruct the original program or use it as a reference to start a new arduino program. Google should be able to help you with working with assembly.
I think you will have more success using a deleted file recovery tool on the PC that you used to develop the sketch. Downloading the binary image from the board will not give you anything that you can use to develop the sketch subsequently; at best you could, with a lot of work, produce something that could be uploaded to another identical Arduino.