Last active
December 30, 2017 06:13
-
-
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).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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