watchdog timer or another way to reset

Hello everyone, I found a problem with the Arduino. When I use a matrix keypad (3x4) and press the buttons stupid fast for a while variables don't get set (such as time) and my program goes nuts. I've found a way to detect if this were to happen (although rare) but I need a way to reset the Arduino.

I've read about the watchdog timer and it seems to be perfect but I can't figure out how to implement it. I don't have a problem burning a new bootloader either.

Anyone know how to do it? Or a similar technique? I don't really want to have a pin pull the reset button either (as this is wrong).

Thanks :slight_smile:

EDIT:

lol omg, I'm retarded. I figured out the problem, I was using INTs instead of UNSIGNED LONGs to hold time variables ::slight_smile:

hahha, of course it was crashing. Agh, gota stop programming at 3 am. It would still be nice to know about the watchdog tho :sunglasses: