Some questions about SLEEP, RTC and IRQs

  • Hi again!
    The WiPy documentation shows, that the RTC is a valid wakeup source for the sleep mode. Derived from the example in the documentation and another forum thread I made this short example:

    import pycom
    import time
    from machine import RTC
    pycom.rgbled(0x007f00) # green
    pycom.rgbled(0x7f0000) # red
    pycom.rgbled(0x000000) # off
    rtc = machine.RTC()   # init with default time and date
    def alarm_handler (rtc_o):
        global rtc_wake
        rtc_wake = True
    # create a RTC alarm that expires after 5 seconds
    rtc.alarm(time=5000, repeat=True)
    # enable RTC interrupts
    rtc_i = rtc.irq(trigger=RTC.ALARM0, handler=alarm_handler, wake=machine.SLEEP)
    # go into suspended mode
    while True:
        if rtc_wake:
            rtc_wake = False
            pycom.rgbled(0x7f0000) # red
            pycom.rgbled(0x000000) # off

    But the code won't run. It seems to me, that the alarm feature of the RTC isn't implemented on my ESP32 based WiPy. Can someone confirm this?
    If this is true, how can I wakeup the WiPy from sleep mode?


  • @Thosch42
    currently only


    is supported - this is only wakeup "source" - we all waiting for more :)

Log in to reply

Pycom on Twitter

Looks like your connection to Pycom Forum was lost, please wait while we try to reconnect.