Identify what sketch is actually on a UNO

I have 2 UNOs. One has an LCD wired to it and when I connect it to a PC it powers up and shows text. It was a counter sketch. Unfortunately I have lost all my sketches and would like to see the coding for this on my IDE. I have another bare UNO board which I believe also has a sketch loaded. I can't see any obvious way of downloading the sketch from the UNO back to my PC.

Your sketch - i.e. the code you typed in - is not stored on the UNO. Your sketch is compiled, assembled and linked together by the IDE and the resulting machine code is programmed into the 328P microcontroller on your UNO.

You can retrieve the machine code from your UNO and you can probably disassemble it back into assembler code but that's as far as you can go.

You cannot recreate your high level language sketch.

1 Like

There is no way to recover the C/C++ source code from the Uno. Only the machine code translation is stored on it.

1 Like

Thanks guys for your very quick response! I was worried it might be something like that.
Many thanks, back to the drawing board I think.

1 Like

One suggestion, for future reference - if you add code in setup() to print out the name of the file, you'll always know what it is you have to look for in your PC (which I realize, you're saying you don't have). It's something like

Serial.println(F(__FILE__));

IIRC, the correct syntax; others will correct me, or add other information that can be printed to help further.

3 Likes

I've taken to doing this. I also output DATE so I know what version.

1 Like

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