Hi,
below is whole code. Im getting into low power. Like that code will run smoot and print "test" every ~2 sec.
but when you remove that 20ms delay then it get weird. Serial print doesnt really work etc..
Anybody have idea?
Running on fresh and empty arduino nano. I tried another board also same thing..
void setup() {
Serial.begin(9600);
//SETUP WATCHDOG TIMER
WDTCSR = (24);//change enable and WDE - also resets
WDTCSR = (7);//prescalers only - get rid of the WDE and WDCE bit
WDTCSR |= (1 << 6); //enable interrupt mode
//Disable ADC - don't forget to flip back after waking up if using ADC in your application ADCSRA |= (1 << 7);
ADCSRA &= ~(1 << 7);
//ENABLE SLEEP - this enables the sleep mode
SMCR |= (1 << 2); //power down mode
SMCR |= 1;//enable sleep
}
void loop() {
__asm__ __volatile__("sleep");//in line assembler to go to sleep
Serial.println("test");
delay(20);
}
ISR(WDT_vect) {
//DON'T FORGET THIS! Needed for the watch dog timer. This is called after a watch dog timer timeout - this is the interrupt function called after waking up
}// watchdog interrupt