Created
March 15, 2017 15:21
-
-
Save LosantGists/854c9f0647eea8b3246dad77437b687f to your computer and use it in GitHub Desktop.
An example showing how to put a ESP8266 device into Deep-sleep mode
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
/** | |
* An example showing how to put ESP8266 into Deep-sleep mode | |
*/ | |
void setup() { | |
Serial.begin(115200); | |
Serial.setTimeout(2000); | |
// Wait for serial to initialize. | |
while(!Serial) { } | |
Serial.println("I'm awake."); | |
Serial.println("Going into deep sleep for 20 seconds"); | |
ESP.deepSleep(20e6); // 20e6 is 20 microseconds | |
} | |
void loop() { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As the seconds value (20) is mentioned in the line above I suspect it was meant to say
ESP.deepSleep(20e6); // 20e6 is 20000000 microseconds
Just in case the reader is not familiar with Exponential Notation (It simplifies numbers by getting rid of zeros, and making math easier)