← index #7035Issue #3821
Off-topic · high · value 2.199
QUERY · ISSUE

rp2: Can't wake from lightsleep with Pin IRQ

openby peterhinchopened 2021-03-15updated 2026-03-24
port-rp2

On a pin change this code sample toggles the LED but never outputs "got here".

from machine import Pin, lightsleep
p25 = Pin(25, Pin.OUT)
p0 = Pin(0, Pin.IN, Pin.PULL_UP)
def foo(_):
    p25(not p25())  # Toggle the LED

p0.irq(foo, trigger=Pin.IRQ_FALLING)
while True:
    lightsleep()
    print('Got here')

The docs indicate that to fix this, the IRQ should be instantiated with wake=machine.SLEEP. Unfortunately this constant does not exist.

CANDIDATE · ISSUE

ESP32 - Cannot get Pin IRQ To Trigger

closedby diginfoopened 2018-05-27updated 2018-06-15
port-esp32

I can get the device to wake from deepsleep:

import machine as mc
p26 = mc.Pin(26,mc.Pin.IN, mc.Pin.PULL_UP)
p26.irq(trigger = mc.Pin.WAKE_HIGH, wake = mc.DEEPSLEEP)
mc.deepsleep()

but it refuses to trigger on edge:

import machine as mc
p26 = mc.Pin(26,mc.Pin.IN, mc.Pin.PULL_UP)
def x():
    print('hello pin')

p26.irq(trigger=mc.Pin.IRQ_FALLING, handler = x )

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied