I am making a low consumption system with an ESP32. I use deepsleep mode to save power. I need to wake up my ESP32 every x seconds and when a button is pressed. To achieve that I use the following code:
Code: Select all
import machine
import time
import esp32
time.sleep(2)
d1 = machine.Pin(14, machine.Pin.IN, machine.Pin.PULL_UP)
bit0 = d1.value()
print (bit0)
esp32.wake_on_ext0(d1)
machine.deepsleep(20000)
I have tested this code on two different ESP32 boards, can anyone explain this or test this code?
Thanks in advance.
Ander.