Hi all… I’ve been wondering about this scenario for some time. I think it’s a valid concern no matter what board you are experimenting with.
Here it is. Currently the board is running a sketch that configures Pin 5 as an OUPUT and sets its’ value to HIGH.
All is well. We change to another project where the sketch configures Pin 5 as an INPUT and the pin is connected to the data out pin of a sensor. The question is… if we assemble the new circuit and power up the board with the old sketch still loaded, will the sensor or the board be damaged? The 30+ years I spent working as an Electronics tech tells me this is asking for trouble.
Is there some sort of protocol for doing this safely, or does it not matter?
Maybe uploading the new code before circuit assembly?
To be honest, I usually don’t think about that. I’m not sure if it doesn’t matter or if I was just lucky until now.
But, in theory, yes, we should have careful with that. It might damage the board or the sensor, even though nothing happened to my boards or sensors until now.
However, the best practice is to upload the new code before assembling the circuit. Not only because of that but also because some GPIOs, when connected, might cause issues uploading code to the board.
The best procedure to follow would be:
- Upload the new code
- Disconnect power from the board
- Assemble the circuit
- Power the board again
- Press the RST button to restart the board