This sketch
#include <LowPower.h>
void setup() {
Serial.begin(9600);
Serial.println("test lowpower");
}
void zdelay() {
LowPower.idle(SLEEP_FOREVER, ADC_OFF, TIMER2_OFF, TIMER1_OFF, TIMER0_ON, SPI_OFF, USART0_ON, TWI_OFF);
}
void loop() {
zdelay();
Serial.println(millis());
}
prints one line every millisecond or thereabouts. I expected it to suspend in low power mode until I sent it a character on the serial line. Similarly, SLEEP_1S does not delay for 1 second as delay(1000) does. Sketch compiles and links without error.
What am I doing wrong or misunderstand?
On the plus side, using this lowpower sleep instead of delay(1000) does cut power consumption by a few mA.