Created
October 10, 2024 14:14
-
-
Save mattgaidica/b3fffc20bad6a1a91732f29b411f3009 to your computer and use it in GitHub Desktop.
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
// Example to enter deep sleep after 10 seconds and wake up with a GPIO pin | |
void setup() { | |
// Initialize Serial for debugging | |
Serial.begin(115200); | |
delay(1000); // Wait for the serial to initialize | |
// Set GPIO pin for wakeup | |
esp_sleep_enable_ext0_wakeup(GPIO_NUM_0, 0); // Wake on low signal on GPIO 0 | |
// Start deep sleep | |
Serial.println("Entering deep sleep mode in 10 seconds..."); | |
delay(10000); // Wait 10 seconds | |
esp_deep_sleep_start(); // Enter deep sleep mode | |
} | |
void loop() { | |
// The device will never reach here as it goes into deep sleep | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment