I have lost my sketch from my computer. How can I import it back from my Uno where it is stored now?
I am a newbie as you casn see. Any and all help is appreciated!
You can't really. It must be possible to retrieve compiled code, though it must require some form of hardware manipulation. You would have to read the Flash-memory of the ATmega, and for that i guess you would need a separate microprocessor to access the data & address bus (without the ATmega interfering) So theoretically it must be possible, but in practice i do not know of any 'how-to'z available online and then still that would be the compiled version, which is the result of compiling the source code, not the source itself. Search your computer again ! else start over, we all had to learn this lesson one day.
The sketch is compiled into machine instructions before being sent to the Arduino. The original sketch only exists on the machine where you wrote it (unless you made any copies or have a backup system in place).
You can use the programming interface and avrdude to retrieve the compiled code, and even program it into another Uno, but the source code including the variable names and any comments is gone.
Hi,
Can I suggest when you are coding, you update your code regularly, saving and changing the name by adding version numbers, even unfinished code will help if you loose your file.
For example;
Mycode_1
Mycode_2
Also in the setup() part of your code, start serial.begin and make a line in the setup serially print your file name.
For example;
void setup()
{
Serial.begin(115200);
Serial.println("======Mycode_1=====");
}
This way each time you reset your controller the IDE monitor will display your code's file name, then you can search your harddrive for the filename if you cannot find your code.
How did you loose the code, delete it or have you just lost it somewhere on your computer?
Tom..
On the wider issue, I assume from your question that you don't back your computer up. Please do this at least once a week, either to external hard drives or an online back up service. One day the hard drive in your computer will die. When it does you will get little or no warning and you will discover you have lost everything.
Yes, I do normally make backups weekly, but had hard drive failure before the weekly backup and the new code had never been backed up since I just wrote it. Thanks for the Ideas.
Serial.println("======Mycode_1=====");
This is a crazy waste of a precious resource.
It should be. Serial.println(F("======Mycode_1====="));