Resetting Arduino via Code

I’m imagining a circumstance where I might want my arduino to reset itself if a condition occurs.  Right now the program is alerting me of this condition, then I have to go and press the reset button.  Not hard, but annoying.

The reset pin is how I’ve wired an external reset button:  a momentary switch grounds the reset pin (making it LOW), and the board resets.  I think I can create the same thing with code

Here’s what I’ll use:

int led = 13;//pin 13 as OUTPUT LED pin
int resetPin = 12;

I’ll connect my reset pin to a digital pin.  Then the code will use a digital.write to bring that pin low, resetting the board.  Here’s a fritzing.org diagram:

reset arduino without manual button

Follow and Like Us: