[SOLVED] Read sketch from NodeMCU

Hi,
I have lost the original sketch file I uploaded to my NodeMCU. Is there a way to retrieve the sketch from my NodeMCU?
Thanks

The sketch is compiled before upload, so short answer is “no, not really”

@Dave_Dunphy this is a long shot but when the Arduino IDE compiles your sketches it puts a copy in a temporary directory along with the bin file, libraries etc.

You can see the location of the temporary directory in the IDE during compilation and for Windows it is normally:

C:\Users[username]\AppData\Local\Temp\arduino_build_xxxxx

Storage in the \Temp\ folder is supposed to be temporary but sometimes they are retained indefinetly.

Try a search for *.ino.cpp in the C:\Users[username]\AppData\Local\Temp folder

The search will bring up .ino.cpp, .ino.cpp.o and .ino.cpp.d files and it’s just the .ino.cpp files that you are looking for.

For me it brings up 155 sketches since March 2016 but this is just a small selection of the sketches I have created during this period. For example it shows my recent sketch as the 1st August and then a huge gap back to the 22nd July.

I believe the temporary files are only retained indefinitely if your Arduino IDE crashed with open sketches or maybe even your PC crashed with open sketches.

It’s worth doing a search as you might find something useful.

1 Like