Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void setup()
- {
- set_sleep_mode(SLEEP_MODE_PWR_DOWN);
- //do stuff so I can see that it just turned on
- }
- void loop()
- {
- //do stuff so I can see that Im in loop
- //sleep and wakie stuff
- wdt_reset();
- WDTCR |= (1<<WDCE)|(1<<WDE);//enable change of prescalar
- WDTCR = (1<<WDIE)|(1<<WDE)|(1<<WDP3);//prescalar set to 4sec before overflow, and interrupt mode
- //all the sleep things:
- cli();
- sleep_enable();
- sei();
- sleep_cpu();
- sleep_disable();
- sei();
- WDTCR |= (1<<WDCE) | (1<<WDE);
- WDTCR = 0x00;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement