lopy4 wakeup on change
-
I'm trying to figure how to wakeup a lopy4 when a float switch changes (either off-to-on or on-to-off).
import machine, time; from machine import Pin switch=Pin('P23', Pin.IN, Pin.PULL_UP) print ('switch', switch(), 'deepsleep') #read switch eg 0=on machine.pin_sleep_wakeup(pins=['P23'],mode=not switch(),enable_pull=1)#wakeup when switch changes eg 1=off machine.deepsleep()works but feels clunky & if the switch changes state between the last line & the second last line it won't wakeup. Is there a way to detect a change other than specifying the change you expect before hand?
-
@kjm that’s a limitation of the ESP32 itself. There are two ways to wake up from deep sleep on pin state changes, and both require you to specify the target level.
See https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/sleep_modes.html for details.
There may be alternatives using the ULP co-processor, haven’t checked if that would actually be possible.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login