Skip to content

Instantly share code, notes, and snippets.

@arilop1994
Created February 27, 2019 17:32
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 arilop1994/1cc2b2c2f20e85fdc67dc179641285a8 to your computer and use it in GitHub Desktop.
Save arilop1994/1cc2b2c2f20e85fdc67dc179641285a8 to your computer and use it in GitHub Desktop.
Watchdog Arduino
#include <avr/wdt.h> // Incluir la librería que contiene el watchdog (wdt.h)
void setup()
{
wdt_disable(); // Desactivar el watchdog mientras se configura, para que no se resetee
wdt_enable(WDTO_4S); // Configurar watchdog a cuatro segundos
// Puedes usar el tiempo que te convenga de la lista de arriba
}
void loop()
{
wdt_reset(); // Actualizar el watchdog para que no produzca un reinicio
//Aquí iría el código de tu programa
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment