Flush serial in DeepSleep example to allow print before sleep (#1791)

* Add delay into example to allow print before sleep

* Changed to Serial.flush()
This commit is contained in:
lbernstone 2018-09-17 12:31:24 -07:00 committed by Me No Dev
parent c8fe873965
commit f9f995b283

View File

@ -40,7 +40,7 @@ void print_wakeup_reason(){
case 3 : Serial.println("Wakeup caused by timer"); break; case 3 : Serial.println("Wakeup caused by timer"); break;
case 4 : Serial.println("Wakeup caused by touchpad"); break; case 4 : Serial.println("Wakeup caused by touchpad"); break;
case 5 : Serial.println("Wakeup caused by ULP program"); break; case 5 : Serial.println("Wakeup caused by ULP program"); break;
default : Serial.println("Wakeup was not caused by deep sleep"); break; default : Serial.printf("Wakeup was not caused by deep sleep: %d\n",wakeup_reason); break;
} }
} }
@ -84,6 +84,7 @@ void setup(){
reset occurs. reset occurs.
*/ */
Serial.println("Going to sleep now"); Serial.println("Going to sleep now");
Serial.flush();
esp_deep_sleep_start(); esp_deep_sleep_start();
Serial.println("This will never be printed"); Serial.println("This will never be printed");
} }