Author Options:

Remove a sketch from ATmega328 Answered

Is It possible to remove a sketch from an Arduino with a 328 using the Arduino IDE?
I have deleted the sketch from my PC.
The program is running now but no more sketch in the Arduino files.
Or is rewriting it the only way?   


No controller should ever get hooked to Input and Output devices unless it is cleared of logic or has a known program that matches the hardware. Arduino is pretty much a toy but get good safety habits now. Full size robots or control systems can be dangerous.

Just rewrite with a blank sketch. Is there a reason you need to do this?

I believe a blank sketch would be:
void setup()
void loop()

Maybe i wrote the question not as clear as i could.
I have a LM35 thermometer sketch with LCD readout running now on my Arduino, but i deleted the program from my computer.
I was asking if it is possible to read the program on the chip and put it back into the Arduino IDE.

Kind of a reverse programming or if the only way is to re write the sketch again.

No way to get back the original sketch. The Arduino contains the compiled image only so you could at most get back Atmega assembly language.


So my lesson here is be more careful when saving sketches.


Yep, learn from your mistakes and keep a backup in the future.

I believe you can acutally save the .hex file to your computer, using a programmer (e.g using an AVRISP MKII and Avr Studio)

However the resulting file will not be editable, at least not through the arduino software/language itself

That is getting beyond my skills at this time.
I have already re written it again.
Good for me anyway i need the practice.