0

I'm working on a project and my dad hit the reset button on my Arduino board, unknowingly. If it wasn't connected to any power source or computer, did it still reset? Do I have to upload my code to the board again? Or does the board need power to be reset?

1
  • 3
    Was the board turned off? The reset button doesn't do anything if no power is attached to the board. Commented Apr 6, 2017 at 5:19

1 Answer 1

9

The reset on an Arduino does not erase anything. It merely restarts execution of an already uploaded program. Also the AVR needs to be powered on for it to realize whether it has been reset.

Every time you power on an Arduino it automatically starts code execution from the beginning of the program in the flash memory.

3
  • Everything in RAM (non persistant memory) will be erased. progmem/flash and EEPROM are persistant and will not be erased.
    – aaa
    Commented Apr 6, 2017 at 6:37
  • you can't erase RAM any more than you can erase a projector screen; electrons+photons erase themselves.
    – dandavis
    Commented Apr 6, 2017 at 9:57
  • 4
    Actually, pressing RESET doesn't erase RAM. It resets the CPU and sets all SFRs to power-on defaults, but the RAM remains the same. It's the code that is added to the start of your program (crt0.o) that erases the BSS area and copies any other defaults into place from flash. The rest of RAM continues to hold what was in there before. Of course, with no power applied it's all rubbish anyway, since nothing is happening.
    – Majenko
    Commented Apr 6, 2017 at 10:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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