← index #3834Issue #3821
Related · high · value 1.540
QUERY · ISSUE

pyboard - deepsleep wake pins

openby diginfoopened 2018-06-02updated 2019-04-18
port-stm32

I have just switched to pyboard for a project which has been on the esp32 and I need to be able to wake from deep sleep by either time or a pin edge.

https://github.com/micropython/micropython/blob/master/docs/library/machine.Pin.rst
https://docs.micropython.org/en/latest/pyboard/library/machine.Pin.html

These pages indicate that the syntax for enabling a wake-up pin is:

import machine as mc
door = mc.Pin('X1',mc.Pin.IN)
door.irq(handler=None, trigger=(mc.Pin.IRQ_FALLING | mc.Pin.IRQ_RISING),wake=mc.DEEPSLEEP)

However this results in an error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'DEEPSLEEP'

What's the solution ?

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