esp32 - sleep mode

nisim-kwik
Posts: 3
Joined: Thu Nov 17, 2016 3:47 pm

esp32 - sleep mode

Postby nisim-kwik » Mon Nov 21, 2016 2:22 pm

Hello,

How set the esp32 in sleep mode and how wake up?
Someone can give example or source code?

Tanks,
Nisim

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: esp32 - sleep mode

Postby kolban » Mon Nov 21, 2016 4:54 pm

I believe the answer lies in calling "system_deep_sleep()". This takes a parameter of the number of microseconds to sleep for. When called, the device will all but power itself down and when the interval duration has passed, it will wake up and start again. I believe some small amount of non volatile RAM may remain refreshed so you can remember some state on wake up.

I also believe that there may be a way to specify an alternate wake up mechanism beyond just an interval timer using a GPIO pin signal change. This may work in conjunction with the deep sleep timer ... so the device will wake up again either because of a timeout of the interval or as a result of a GPIO signal change.

All in all, the core function is "system_deep_sleep()".

See also:
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

nisim-kwik
Posts: 3
Joined: Thu Nov 17, 2016 3:47 pm

Re: esp32 - sleep mode

Postby nisim-kwik » Tue Nov 22, 2016 11:33 am

Thank you for your reply but "system_deep_sleep()" not work for me.
I use the blink led example and add button to set the esp32 in sleep mode for 10 sec but the led still blinking.
Someone can give example code?

Thanks,
Nisim

Who is online

Users browsing this forum: Baidu [Spider] and 99 guests