Uploading code

Is there a way to upload the arduino code without the previous program running?

See, I’m trying to connect the USB cable to my PC to upload a code. However, as soon as I connect the USB to my Arduino, my robotic arm goes crazy. This is obviously due to the fact that there is a previous program in the board. Another way to put my question is, if there is a way to upload my sketch without running the previous one as soon as I connect the USB cable to my Arduino?

Thanks!

Hold the reset key until the IDE starts uploading.

The IDE actuates reset as part of the uploading process anyway. You just have to pick the time to release it.

Ok, thank you

Why don't you just disconnect the power supply to the arm's motors?