ESP32 lightsleep() WDT conundrum #10173
-
I want to put an ESP32 into lightsleep() and also to check that it is still I want the system WDT and/or a SW WDT to bring the unit out of lightsleep(), In:
I already use Pin change to trigger running the code to take a picture. I understand that RTC timeout just refers to the value you put in lightsleep(), correct? I guess what I would like is when lightsleep(60000) times-out that I get a different Any suggestions welcomed. Is there anything I could do with RTC.alarm or RTC.irq()? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Wasn't so difficult after all: import esp32
from machine import Pin, lightsleep
import utime
wake_source = Pin(27, Pin.IN) # setting wake up pin, has a 10K to ground
esp32.wake_on_ext0(pin = wake_source, level = esp32.WAKEUP_ANY_HIGH)
print ('waiting for 5 seconds to allow a CTRL-C')
utime.sleep(5)
while True:
if (wake_source.value() == 1):
print ('we got a valid trigger')
utime.sleep(0.1)
# do the processing you want
# feed the watchdog(s)
print ('going to lightsleep for 60 seconds')
utime.sleep(0.1)
lightsleep(60000) BTW, it looks RTC.irq() is not in v1.19.1 |
Beta Was this translation helpful? Give feedback.
Wasn't so difficult after all:
BTW, it looks RTC.irq() is not in v1.19.1