Required help on Hard reset within arduino program

Hello,

I would like to know is there any possible way to hard reset the entire microcontroller unit through arduino program by connecting digital pin to GND pin as same as pressing a button on arduino board.

  • What is the need to do this ?

  • This will not Hard Reset any I/O.

I am just experimenting to reset I/O pins through program.

  • Not sure what the application might be.
    :thinking:

Yes there is. You can use any pin and when it goes low, just enable the WDT with the fastest timout.

// You could use interrupts instead of polling
// the pin state but you may want to do things like
// save data befor you reset

#include <avr/wdt.h>

void setup()
{
  pinMode (3, INPUT_PULLUP); // Button
  pinMode(13, OUTPUT); // LED

  // Blink the LED
  for (int i = 0; i < 10; i++)
  {
    digitalWrite(13, LOW);
    delay(50);
    digitalWrite(13, HIGH);
    delay(50);
  }
}

void loop()
{
  byte button = digitalRead(3);
  if (button == LOW)
  {
    // Maybe do something here before you reset
    wdt_enable(WDTO_15MS); // RESET
  }
  delay (10);
}
//

I am trying to use the following command

    byte button = digitalRead(RESET_PIN);
  if (button == LOW)
  {
    // Maybe do something here before you reset
    wdt_enable(WDTO_15MS); // RESET
  }
  delay (10);

  if (systemShutdown) {
   return;  // Exit the current iteration of loop() but it will be called again
  }

I want to stop the loop and if I connect reset_pin with GND system should reset. How to achieve this?

As soon as you push the button, everything will stop and the device will be reset

1 Like

If I understand correctly you could use 2 Pins.

One Pin will put Loop in a permanent While() loop.The Program Counter will alway loop it will never stop.

Second Pin will Reset the prossesor.When and how depends on what you want to do.

How will you start the loop when it "stoped"?