8

Does anyone know how to prevent the Uno from running the last program when it's powered on?

Many times I have changed hardware and wiring without clearing the program first. Then when I power it on to upload the new program it will run the old program until it's uploaded. This has many potential unwanted effects when the old program is running with the new hardware installed.

Ambo100
  • 107
  • 7
perigalacticon
  • 357
  • 3
  • 14

1 Answers1

13

The simplest thing is to upload the new program before connecting the hardware.

If this isn't practical, connect a jumper wire from the Reset pin to ground (Gnd) before powering it on. This will hold in a reset state, and the program won't run.

Then, compile and upload your program. As it starts to upload remove the reset wire. That should upload it without running any existing program.

Nick Gammon
  • 38,184
  • 13
  • 65
  • 124
  • Thanks, Sometimes for big projects with lots of connections this feature would be useful. Should the reset button have the same effect? Is there documentation on the feature? Thanks. – perigalacticon Mar 10 '16 at 13:23
  • I'm not sure about documentation - well there is now, in the answer here. :) The Reset button would have the same effect but it can be tricky holding it down with one hand and uploading the new code with the other. – Nick Gammon Mar 10 '16 at 19:37