A simple Watchdog for Digispark/ATtiny85. How?

Hi, I can't find a simple library for doing that, avr/wdt.h doesn'0t work properly, I can't figure out how to searching everywhere, I don't need sleep mode, I just need to reboot in case the CPU hangs for any reason.
Thank you a lot!

This doesn't work, it does one reboot, then stucks.

#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/wdt.h>

void setup() {
    wdt_enable(WDTO_2S);
}
void loop() {
     //   wdt_reset();
    }

clearing every setup the watchdog flag MCUSR &= ~_BV(WDRF); doesn't help too

I've solved by updating the Bootloader of Digispark, I strongly recomend everyone to do so, it's easy and via USB. Earlier versions have many bugs!

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