Skip to content

Instantly share code, notes, and snippets.

@IOT-123
Last active December 30, 2017 06:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IOT-123/ecf54a727de53e095c276241d5f62bd8 to your computer and use it in GitHub Desktop.
Save IOT-123/ecf54a727de53e095c276241d5f62bd8 to your computer and use it in GitHub Desktop.
A simple sketch to test the D1M SLOG (SLeep + watchdOG) deep sleep function. Ensure both jumpers are set to the outer position (connecting D0 to RST).
// during wake prints 3 lines to console only
// then sleep 10 seconds, then repeat...
const int sleepSeconds = 10;
void setup() {
Serial.begin(115200);
Serial.println("\n\nWake up");
// Connect D0 to RST to wake up
pinMode(D0, WAKEUP_PULLUP);
}
void loop() {
Serial.println("loop point 1");
delay(1000);
Serial.println("loop point 2");
delay(1000);
Serial.println("loop point 3");
delay(1000);
Serial.printf("Sleep for %d seconds\n\n", sleepSeconds);
// convert to microseconds
ESP.deepSleep(sleepSeconds * 1000000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment