I have a button with two isolated tracks. I want to be able to wake up esp from deepSleep with this button, and also detect that it was clicked. So i can't connect it to reset, because esp won't work if i don't release a button. And if it's not at deepSleep, it will reset, and i don't want it. How to do this?
You can't stop deepSleep, all you can do is reset the board so connect the button to the reset pin and make the appropiate set-up:
- Connect a pullup resistor (10k) in RST
- Connect the button from RST to GND
When you push, RST has GND so the ESP gets reseted.
Remember that deepsleep only works for about an hour so you have to contemplate this situation, too, maybe with a static variable...
EDIT Thanks Juraj for the comment: "from SDK API "system_deep_sleep(0): there is no wakeup timer; in order to wake up, connect a GPIO to pin RST; the chip will wake up by a falling-edge on pin RST."