Incoming Noob question alert!

So, I am new to this platform and I have a few questions.

  1. What happens when I upload a new sketch to the Arduino from the Arduino IDE, the older sketch gets deleted? or older one still survives in the Arduino memory somehow? if it does.. what happens when it runs out of memory? and how do you go about choosing which one to run?I have a feeling that the old one gets deleted, but I want someone to confirm it.

  2. I understand that the there is a void setup () part and void loop () part, the void loop part keeps the thing going indefinitely. Regardless, is there a way to start/stop the program? without cutting the power to the board?


Noob questions most welcome!

  1. The old program is erased, and a new one written.

  2. To pause the program, you could try sending the Arduino to sleep, but then you would need an interrupt to wake it up again and resume processing. You could also put the Arduino into a another loop waiting for an input to continue.


while(1) {
    if (digitalRead(2,LOW)) break;

This will keep the program stuck in the while loop until pin 2 is brought low (checking every 100ms). Make sure to set pin 2 to an input pin in setup(), e.g.:


The difference between putting the Arduino to sleep and putting it in a loop is that sleep mode consumes less power.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.