Hi @dick-san. I'm sorry about the problem with saving in the IDE.
Please add a forum reply here to tell us which operating system you are using (e.g., "Windows")?
I ask because I would like to give you the appropriate instructions for your operating system.
That is correct. It is usually possible to download the program from the Arduino board, but the program in the board is a binary, not the Arduino code it was compiled from. You can disassemble the binary to assembly language code, but translating that assembly into the original Arduino sketch would be very difficult and time consuming.
However it might be possible to recover your sketch a different way. Arduino IDE copies your sketch to a temporary folder during the compilation process. It is possible the full sketch is still stored in that folder. It will be in a folder under this location:
<system temporary folder>/arduino/sketches/
(where <system temporary folder>
is the standard folder for temporary files used by your operating system)
You can try doing a search through that folder for the filename of your sketch.
Here is an example of a path on a Windows system:
C:\Users\<username>\AppData\Local\Temp\arduino\sketches\3A9AF02994178C2791F98B37AF39F346\MySketch\MySketch.ino.cpp
Note that a .cpp
file extension has been appended to the original sketch filename.
Please note that this data is temporary. It can be overwritten by Arduino IDE or deleted by your operating system at any time. So if you are going to try to recover the sketch, you should do it as soon as possible. You should also be careful to avoid performing actions that would trigger the loss of the data before attempting the recovery:
- Do not compile or upload your sketch in Arduino IDE.
- Do not close Arduino IDE.
- Do not shut down or restart your computer.
- Do not perform any operations to automatically free up disk space.
If you find the sketch file in the temporary folder, you will notice Arduino IDE made some changes in the code. These changes are minimal so it will be easy to convert the code back to your original sketch. We can help you out with that if you have trouble.