Pages: [1]   Go Down
Author Topic: WDT reset on delay() ?  (Read 797 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi boys,
please, can you help me? I ´am using sketch with wdt timer ON. Is possible to reset wdt timer in delay() function?
When I call delay(5000), my wdt is overrun.
Is any other way to reset wdt in delay as use 5x 1000mS delay with wdt_reset() after every seconds?

Many thanks,
Petr
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 610
Posts: 48993
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Is any other way to reset wdt in delay as use 5x 1000mS delay with wdt_reset() after every seconds?
No. Screwing around with smaller values in the call to delay() is not the answer either. Reading, understanding, and embracing the blink without delay example is.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK, thanks :-) But it´s not easy solution of simple problem :-)))))))

So, I will be experimenting with timing of main loop :-) But only in my second program... today I have made multiple delays of one second...

I created a nice function for it :-)


Code:
void delayS(int number)
{
     for (int i=0; i < number; i++){
    wdt_reset(); // reset the wdt
    delay(1000);               // wait for a second
     } 
}

Logged

Pages: [1]   Go Up
Jump to: