Skip to content

ESP32 Light Sleep Mode #475

@architmuchhal12

Description

@architmuchhal12

Hey all,

I want to explore the sleep modes on ESP32 using Arduino IDE. By referring the ESP8266 guide, I am able to put the ESP32 in deepSleep mode.

I want to use my ESP32 in either lightSleep or modemSleep, both of which are not defined in #include "esp_deep_sleep.h" nor they have separate header files in espressif\esp32\tools\sdk\include\esp32.

Is there a way to use the other sleep modes or they are yet to be explored?
I have implemented the sleep modes in the basic Blink program for which the code is attached.

Thank you!

#include "esp_deep_sleep.h"

int ledPin = 5;

// Time to sleep (in seconds):
const int sleepTimes = 15;

void setup()
{
  pinMode(ledPin, OUTPUT);
  Serial.begin(115200);
}

void loop()
{
  Serial.println("Hello, world!");
  digitalWrite(ledPin, HIGH);

  delay(1500);
  digitalWrite(ledPin, LOW);

  delay(1000);
  Serial.println("Please wait...");
  
  Serial.println("Entering deep sleep mode...");
  // deepSleep time is defined in microseconds. Multiply
  ESP.deepSleep(sleepTimes * 1000000);
}


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions