{"id":440,"date":"2016-01-24T15:04:27","date_gmt":"2016-01-24T23:04:27","guid":{"rendered":"http:\/\/nuclearprojects.com\/blog\/?p=440"},"modified":"2016-04-24T15:07:03","modified_gmt":"2016-04-24T22:07:03","slug":"arduino-reset-function-using-only-software","status":"publish","type":"post","link":"https:\/\/nuclearprojects.com\/blog\/arduino-reset-function-using-only-software\/","title":{"rendered":"Arduino Reset Function Using Only Software"},"content":{"rendered":"<p>Here is a simple, clean and proper solution for doing a full Arduino reset via a simple software function. The general solution was found <a href=\"http:\/\/arduino.stackexchange.com\/questions\/1477\/reset-an-arduino-uno-by-an-command-software\" target=\"_blank\">here<\/a> and was implemented as follows:<\/p>\n<p><strong>Include the proper library:<\/strong><\/p>\n<pre>#include &lt;avr\/wdt.h&gt;<\/pre>\n<p><strong>Place this within your &#8220;Setup&#8221; function:<\/strong><\/p>\n<pre>MCUSR = 0;\u00a0 \/\/ clear out any flags of prior resets (used for resetting board)<\/pre>\n<p><strong>The sample &#8216;reset&#8217; function:<\/strong><\/p>\n<pre>void resetBoard(void){\r\n\u00a0 wdt_enable(WDTO_15MS); \/\/ turn on the WatchDog and don't stroke it.\r\n\u00a0 for(;;) { \r\n\u00a0\u00a0\u00a0 \/\/ do nothing and wait for the eventual...\r\n\u00a0 } \r\n}<\/pre>\n<p>&nbsp;<\/p>\n<p>That&#8217;s it! Simply call <strong>resetBoard();<\/strong> anywhere in your code when you wish to reset the board.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here is a simple, clean and proper solution for doing a full Arduino reset via a simple software function. The general solution was found here and was implemented as follows: Include the proper library: #include &lt;avr\/wdt.h&gt; Place this within your &#8220;Setup&#8221; function: MCUSR = 0;\u00a0 \/\/ clear out any flags of prior resets (used for [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29,30],"tags":[],"class_list":["post-440","post","type-post","status-publish","format-standard","hentry","category-electronics","category-programming"],"_links":{"self":[{"href":"https:\/\/nuclearprojects.com\/blog\/wp-json\/wp\/v2\/posts\/440","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nuclearprojects.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nuclearprojects.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nuclearprojects.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nuclearprojects.com\/blog\/wp-json\/wp\/v2\/comments?post=440"}],"version-history":[{"count":2,"href":"https:\/\/nuclearprojects.com\/blog\/wp-json\/wp\/v2\/posts\/440\/revisions"}],"predecessor-version":[{"id":442,"href":"https:\/\/nuclearprojects.com\/blog\/wp-json\/wp\/v2\/posts\/440\/revisions\/442"}],"wp:attachment":[{"href":"https:\/\/nuclearprojects.com\/blog\/wp-json\/wp\/v2\/media?parent=440"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nuclearprojects.com\/blog\/wp-json\/wp\/v2\/categories?post=440"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nuclearprojects.com\/blog\/wp-json\/wp\/v2\/tags?post=440"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}