Skip to content

Instantly share code, notes, and snippets.

@standarddeviant
Created June 23, 2020 16:48
Show Gist options
  • Save standarddeviant/0da9ea89e7a1e8ae61b99496cd8ad79f to your computer and use it in GitHub Desktop.
Save standarddeviant/0da9ea89e7a1e8ae61b99496cd8ad79f to your computer and use it in GitHub Desktop.

I did a lot of searching trying to understand the ESP32-ULP. Here are some links I'd like to save for later.

Hoping this will be of some help...

I struggled over much online help to find code that worked for deepsleep and external wake interrupt.

# magnetic reed switch on IO13
reed = machine.Pin(13, mode = machine.Pin.IN, pull = machine.Pin.PULL_DOWN)
# an external interrupt to wake from sleep if the door opens
reed.irq(trigger=machine.Pin.WAKE_LOW, wake=machine.DEEPSLEEP)
machine.deepsleep()

...this works well. I can pass a wake timer value in ms to the deepsleep() function or wake on interrupt.

Garry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment