Just wondering Question

Hi all...

I've been messing with Arduino for about a year now, have a fine collection of boards from Mega to mini.

So I've been wondering about this for some time. Say I have a sketch already loaded on the Arduino which I'm using with a breadboard. I decide to scrap the circuit and try something new. Once I have the new circuit built and power up the Arduino to upload a new sketch is there any chance of damage to the Arduino or any of the circuitry because the old sketch is going to run before the new sketch is uploaded. I haven't seen any issue so far but I am curious. Is it prudent to upload a blank sketch before changing anything?

thanks,
charlie

investigate clearing the EEPROM. this would be for an old pack horse used in an Arduino class.

Anything's possible. Best practice would be to upload the bare_minimum example sketch to default the board to doing nothing, or to upload the blink example sketch to revert the board to almost factory state.

You definitely want to be careful that your new circuit doesn't create a short on pins that are set as outputs by the old code. Let's say you have a pin connected to ground via a maintained switch that is closed and your old code sets the pin to OUTPUT, HIGH. That's a short that will cause a high current draw from the pin that could damage the chip. A potentiometer could do the same.