Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "esp_sleep.h"
- #include "driver/rtc_io.h"
- #define uS_TO_S_FACTOR 1000000 // Conversion factor for micro seconds to seconds
- #define TIME_TO_SLEEP 10 // Time ESP32 will sleep (in seconds)
- void setup() {
- Serial.begin(115200);
- delay(1000);
- Serial.println("Going to sleep now...");
- esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);
- esp_deep_sleep_start();
- }
- void loop() {
- // This will never be reached
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement