Two Ways to Reset Arduino in Software

by gabriellalevine in Circuits > Arduino

830404 Views, 184 Favorites, 0 Comments

Two Ways to Reset Arduino in Software

Screen Shot 2012-11-06 at 2.26.34 PM.png
If you want to RESET Arduino from the beginning without manually pressing the RESET button, there are a few ways. Here are two ways, using minimal wiring / circuitry. 

Using 1 Wire Connected to the RESET Pin

RESET_bb.jpg
1. electronically, using only 1 wire connecting an OUTPUT pin (12 in this example) to the RESET pin. (see the circuit)

In this example, pin 13, connected to the internal LED pin 13 is blinking. Pin 12 gets connected to the RESET pin by one wire.
-Typically, this would be a problem because when the application starts up, all pins get pulled LOW. This would therefore disable Arduino from every running. BUT, the trick is: in setup() function, the FIRST thing that happens is we write HIGH to the pin 12, which is called our reset pin (digitalWrite(resetPin, HIGH), thereby pulling the Arduino RESET pin HIGH. 

Using Just Software

Blink_bb.jpg
In this example, you do not need any extra wiring. We initialize the reset function, then call reset.

void(* resetFunc) (void) = 0;//declare reset function at address 0
...
resetFunc(); //call reset