Skip to content

Instantly share code, notes, and snippets.

@dennisheitmann
Created August 2, 2019 21:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dennisheitmann/f10de10aa2b936adf733f0d9194f1755 to your computer and use it in GitHub Desktop.
Save dennisheitmann/f10de10aa2b936adf733f0d9194f1755 to your computer and use it in GitHub Desktop.
Arduino Software "Reset" (restart of sketch)
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