Created
August 2, 2019 21:21
-
-
Save dennisheitmann/f10de10aa2b936adf733f0d9194f1755 to your computer and use it in GitHub Desktop.
Arduino Software "Reset" (restart of sketch)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void softwareReset(unsigned long delayMillis) { | |
uint32_t resetTime = millis() + delayMillis; | |
while (resetTime > millis()) { | |
/* wait and do nothing until the required delay expires... */ | |
} | |
// jump to the start of the program | |
asm volatile("jmp 0"); | |
} | |
void setup() { | |
// put your setup code here, to run once: | |
} | |
void loop() { | |
// put your main code here, to run repeatedly: | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment