Newbie question :plugging in usb with new wiring but old code

Sorry if this doesn't make sense but here goes;

I upload a program to the UNO and have all the wiring in place on the breadboard. all is good. So now I want to upload a different program with different wiring. So I have wired the breadboard to prepare for the new program but when I plug in the UNO it runs the existing code in memory until I upload the new code. What if, for example the UNO is trying to read pin 12 from old code but I have an LED there now and different wiring...could this be a potential problem? is there a way to plug in USB without the old code running right away so that I can upload the new code (which corresponds to the new wiring)?

Hope this makes sense.
Thanks in advance

An Arduino will always run the last sketch loaded regardless of what is connected.

Where changing projects it is always safer to disconnect the prior wiring first and BEFORE uploading any new code that may be substantially different.

Ok that makes sense but what if the old code runs upon plugging usb in and potentially causes a short with the new wiring? For example the old code has an LED connected to pin 11 but new wiring has a diode there. Now old code runs as soon as USB is plugged in and old code tries to run the LED on pin 11 but is routed to a diode for example.

Thanks so much

The same.

Disconnect the board inc any PSU....disconnect the wiring...upload the NEW sketch.

Disconnect the board inc any PSU...connect the new wiring and always double check at this point !

Reconnect the USB and or external PSU.

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