Skip to content

Serial.print stops working after sleep(duration)? #3

@jack1728

Description

@jack1728

Hi,

I made some basic changes to timedWakeup.ino and I noticed that after sleeping for 1 second, the serial/usb are turned off and don't turn back on. When you run this, it should stop after the first loop and the print statements and blinking will stop. Anyway to get a full wakeup after PM.Sleep(1000)?

I am running the 2.02 version of the 101 library

#include <Power.h>

volatile int x = 0;
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
Serial.begin(9600);
Serial.println("SEtup");
}

void loop() {
for(int i = 0; i < 5; i++)
{
digitalWrite(LED_BUILTIN, HIGH);
delay(500);
digitalWrite(LED_BUILTIN, LOW);
delay(500);
Serial.println("loop ");
Serial.println(i);
}
Serial.println("full loop ");
Serial.println(x);
x++;
Serial.flush();
PM.sleep(1000);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions