Arduino Uno Sketch upload download questions

Ok ladies and gent i have a really dumb question being fairly new the Arduino area.

I had wrote a sketch it is about 30 lines approx, the laptop i wrote it on the hard drive went CRASH and stupid me i didnt do a backup.

So i know one option is to rewrite the sketch

But i heard someone talk of a way where you can retrieve the code from one Arduino and then upload it to another. How is this accomplished?

Thanks for any and all information.

You do know you will not get the source code.


The source code is working quite fine all i want to do is in the event that the program gets deleted or reset from one of the working units i am able to upload to that unit what was last used.

At least until i get around to re-write the orig sketch

This is not a simple process. There are several threads about this, search copy arduino to arduino or something like that, maybe arduino to pcb.

For 30 lines of code it is not worth the effort.

Edit Consider this a cheap lesson. Your are fortunate it's only 30 lines. Happens to everyone at one time or other, get a Thumb drive ;) .

30 lines, just rewrite. I've done up bigger examples than that here in the forum. And you'll likely find some improvement you can make while you do it, I always seem to in thinking about the code a 2nd time.

Otherwise, there are avrdude commands you can run to download the code into a .hex file so you can reload it. Or if you have a Programmer, I know you can copy it out with Atmel Studio and a Atmel AVR ISP MKii (and perhaps some if its clones), and perhaps with avrdude commands as well.