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.heartbeat(False) pycom.rgbled(0x007f00) # green time.sleep(2) pycom.rgbled(0x7f0000) # red time.sleep(2) 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: machine.sleep() if rtc_wake: rtc_wake = False print('Awake') pycom.rgbled(0x7f0000) # red time.sleep(1) pycom.rgbled(0x000000) # offBut 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?Cheers,
Thomas -
@Thosch42
currently onlymachine.deepsleep(5000)is supported - this is only wakeup "source" - we all waiting for more :)
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