Lack of WDTZero library documentation

Currently implementing a WDT into my MKR NB 1500 project. The only library I have seen on the forums which works with the MKR 1000 is the WDTZero library. But its documentation is really lacking. I found the creator's documentation at GitHub. I don't really understand any of the two example codes which are provided since the lines have barely any comments. And I am not a good enough programmer to have a natural sense of what's going on in the code without explanation. Does anyone have well-commented and explained code from this library that they can share?

it is only two functions setup and clear
setup to set the time
clear to feed the dog so it doesn't bite

Thanks for the reply. I tested out the library with this simple code:

#include <Arduino.h>
#include <WDTZero.h>

WDTZero MyWatchDoggy;


void setup()
{
    Serial.begin(9600);
    while (!Serial)
    {

    }
    Serial.println("Starting up Arduino");
    
    MyWatchDoggy.setup(WDT_SOFTCYCLE16S);
}

void loop()
{
    Serial.println("hello");
    delay(2000);
}

I was expecting the entire circuit to reset when the dog bit, but it just stops. Do I need to add my own reset function and then call it when the dog bites?

I guess the com port changes at reset so setup() stops at while (!Serial);

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.