Some of my current projects and ideas.
Caution many warranties maybe voided.

Thursday, 27 September 2012

Recover Arduino Sketch

How to recover an Arduino sketch from after a program crash or system crash.

I was working on some code today then after making a heap of code changes and uploading to boards I walked away from my computer without saving my Sketch. Due to some other things I was doing at the time Windows crashed and I had not saved my code yet. After a reboot I confirmed that my code was gone but I did not like the idea of that so went digging for it. I know the Hex file is compiled to the %temp% folder so the Sketch must be there too.So Start>Run>%temp%which took me to C:\Users\remote\AppData\Local\Temp\Then I sorted the folders by date modified and then found this one was timestamped about the same time I last compiled my code.C:\Users\remote\AppData\Local\Temp\build262859921630184205.tmp\Opening the folder I see a few C++ files and one of them had the same name as my sketch but with a C++ extension. It was my Aduino Sketch it did have a few things added to it to make it C++ compatible (void's) but is was the code I thought I had lost.