Recover deleted code from Arduino (solved)

Hi!
Urgent question: Is there a way to restore code uploaded to the Arduino after the code window is closed without saving?
Please tell me it's possible... :pray:

1 Like

Download from the arduino -no. There is no source code after compilation.
But you can look in the arduino IDE project temp dir, something like C:\Users\AppData\Local\Temp\arduino_build_132929

1 Like

You can get the compiled code back but not the original sketch. I assume that is not what you were hoping to hear

It is possible that your Operating System has saved a copy of the sketch in a temporary directory but don't hold your breath

1 Like

Where do I look for such a thing?

Hello uriel252

Try in the IDE FILE Open Recent.

I tried. Unfortunately there is only the previous version there before the changes I made and it is very far from the result I got after the changes

Whoever will be the first genius to invent software for reproducing machine code for Arduino commands will probably win a lot of fame...

It is not possible

Did you try to look in the IDE temp dirs as I advised in the post#2?

The truth is that I did not quite understand your proposal. Where do I find it?

C:\Users<username>\AppData\Local\Temp\arduino_build_132929

the numbers in the name of arduino_build_NNNNNN may be different, of course

1 Like

I think I can see how you deleted your own code...

2 Likes

Ignoring background noise...

whenever a code-version has a more or less "running state"
click tools - archive sketch

or do a save as.... and add three digits at the end

myArduino-Project-001
myArduino-Project-002
myArduino-Project-003
...

Do the save as......

prior

to any code-change
start modifying the code

after

you have done the save as.....

With this habit you can rollback to any version inbetween.

As you have experienced now
Not saving your code every few minutes is as careless as laying down a burning gas welder onto straw.

Thanks for the tips! But in my case too late. Apparently some things have to be learned the hard way...

If you successfully compiled the code and uploaded it to the Arduino, the IDE made a temporary copy of it. See post #2.

1 Like

Yes.
In my W11 system, that exists until the ArduinoIDE is closed... then byebye temp directory. Sometimes if the 1.x IDE balks, hiccups, or is killed from Task Manager, those temp files are orphaned until an OS temp-file cleanup is invoked.

1 Like

That is dependent on your OS. With windows open the
DOS prompt and go to C:/ Then type Dir Filename*.* /s, this will cause it to search your entire hard drive for file with that name. You also need to look in the trash as it may be there. In Linux terminal it is: find -name "filename*". Note in windows it is case dumb but Linux is case sensitive.

I am glad it helped. I have been there as well. I keep a copy of all my files on my computer and another set zipped on the server I usually do this when shutting down for the day, Example: "Arduino1(221222).zip" This gives me the ability to go back a few days to where another part use to work.

1 Like

I finally found it this way after a long search... Thanks a lot! I have no words to thank you!!! This was an important changed code for me and if I hadn't found it I would have spent overtime rewriting it...
Thanks also to all the other helpers, bless you!

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.