Legacy Platform Help Articles
Reboot
In the device menu, there's an option to reboot the device. This function is enabled by default in the Blynk.Edgent examples (along with advanced provisioning).
To enable Reboot function manually in your sketch, you need to implement a device-specific procedure:
1
void resetMCU()
2
{
3
#if defined(ARDUINO_ARCH_MEGAAVR)
4
wdt_enable(WDT_PERIOD_8CLK_gc);
5
#elif defined(__AVR__)
6
wdt_enable(WDTO_15MS);
7
#elif defined(__arm__)
8
NVIC_SystemReset();
9
#elif defined(ESP8266) || defined(ESP32)
10
ESP.restart();
11
#else
12
#error "MCU reset procedure not implemented"
13
#endif
14
for (;;) {}
15
}
16
17
BLYNK_WRITE(InternalPinDBG) {
18
if (String(param.asStr()) == "reboot") {
19
Serial.println("Rebooting...");
20
21
// TODO: Perform any neccessary preparation here,
22
// i.e. turn off peripherals, write state to EEPROM, etc.
23
24
// NOTE: You may need to defer a reboot,
25
// if device is in process of some critical operation.
26
27
resetMCU();
28
}
29
}
Copied!
Copy link