Unplug all sensors when altering sketch?

Hey guys!

I am completely new to Arduino and maybe my question is a little bit dumb but I can not find answers to this.

I am controlling a button which when pressed activates my relais which then lets a led flash. That works perfectly fine (the led will be replaced by a water pump it is just for testing - i already did this with a raspberry pi)

To the original question: In the process I may have to change the sketch a couple of times - do I have to:

  1. Unplug the Arduino
  2. undo the wiring of my sensors & co
  3. Then plug the arduino in again
  4. Alter the sketch and upload it again
  5. Then wire all my sensors & co and run it again

or can i just alter the sketch and upload the new one while the old program ins running and just press the reset button after this?

Looking forward to an answer and thanks in advance. PS: it would be cool if someone could state why too. :)

One important thing. If there is something connected that has external power (not from Arduino) turn off that power (or disconnect it) before you disconnect Arduino from its power.

Usually you wont disconnect Arduino so this may be no worry. You do not need to disconnect anything from Arduino pins while uploading code. It is of course smart to think a litte after all: If an input pin is connected to GND and your new code sets that pin OUTPUT and HIGH... Thats not a good ide!

In general: When the Arduino is reset (happens when you upload) all pins ar set as inputs so there is no problems.

First of all - thanks for the answer!

Of course I mean changing the script not the wiring. I understood so much :)

Okay that helps a lot since I unplugged all jumper wires and disconnected him before altering simple things like time delays and so on and that really took a lot of unnecessary work.

Good to know he changes everything to input and resets automatically when uploading a new sketch.

When i press the reset button manually he only restarts the script right?

that is true. (it start the bootloader .. to determine if new code is arriving. when this gets a timeout, your code starts)