Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 3
    The arduino has a reset pin, pull it to ground with switch,and it will reset from the beginning. Commented May 24, 2018 at 15:50
  • i tried your one but it completely reset the arduino , but that's fine for the reset button .any way ,i can interrupt the program while running and change to any other function of the program . such as when we press the reset button it goes to reset, if we press a push button it goes to some any other function. Commented May 24, 2018 at 16:02
  • set a flag variable in the interrupt service function ... check the flag at the beginning of each state function and skip digitalWrite() and delay() commands if the flag is set Commented May 24, 2018 at 16:14
  • you could also use a state variable and call the state functions depending on its value .... use the interrupt to set the state variable to a specific value Commented May 24, 2018 at 16:16
  • you have two identical if statements one after another .... merge the contents into one Commented May 24, 2018 at 16:18