can an arduino code be retreveid ?

ok so heres the qustion if you upload the software to microcontroller,
can you possibly get the code back from the microcontroller if you lost it and if so what should i do ??

am a nooby in programing, am only shooting in the dark here but isnt it possible to get the same code back from memory ? if so what should i do ?

Well, you can download the machine code and save it to a hexfile. It can be used to program other chips of the same kind.

But I assume you wanted to get the C-code back, can't be done.
Mr. Backup is your friend.

If you should be using linux or a mac, I suggest using some sort of version control tools. I personally use GIT to keep my code in order including a full history of changes.

aww i was hoping theres was a way to get the code back.

you were right i didnt back up, i'll search for GIT. would you mind telling me how to get the hex files out of the chip. :cry:

You'll need to run something like this:

avrdude -b 19200 -c stk500 -p m168 -P /dev/ttyUSB0 -U flash:r:saved.hex:i -vvv

This assumes you at an ATmega168 chip (m168) and have it connected to /dev/ttyUSB0.

Most likely you'll need to make some adjustments.

aww i was hoping theres was a way to get the code back.

Google 'avr decompiler' - there seem to be some tools out there.

it still wont be C code, it will just be a dissembler listing