from my unknown reason I cannot set time based "irq" function. I red in documentaiton: "http://docs.micropython.org/en/latest/l ... e.RTC.html" that "Create an irq object triggered by a real time clock alarm.". so I tried to set allarm in boot.py, but always receive this error in bot files.
Purpose of code: to test time based alarm only - that is why it is so simple.
i thought taht I create several alarms like:
Alarm0 - every 60 seconds
Alarm1 - every 20 seconds
Alarm2 - every 15 seconds
Alarm3 - every 5 seconds
and let them be triggered in main.py to do some code (blink - for Alarm0), but I´m not even build a single one.
Board: Lolin d32 Pro V2.0
Micropython firmware: esp32-idf3-20191220-v1.12.bin
boot.py:
Code: Select all
import gc
import machine
import utime
#/-----------------------------RTC-----------------------------/#
rtc = machine.RTC()
rtc.init((2020, 1, 1, 2, 12, 00, 0, 0))
#Format: year, month, day, weekday, hour, minute, second, microseconds
rtc.alarm(0, 60000, repeat=True)
#/---------------------LED Confirmation---------------------/#
LED = machine.Pin(5,machine.Pin.OUT)
LED.value(0)
utime.sleep(0.1)
LED.value(1)
utime.sleep(0.1)
LED.value(0)
utime.sleep(0.1)
LED.value(1)
mani.py:
Code: Select all
def RTC_Timer(pin):
LED.value(0)
time.sleep(0.5)
LED.value(1)
time.sleep(0.5)
LED.value(0)
time.sleep(0.5)
LED.value(1)
time.sleep(0.5)
LED.value(0)
time.sleep(0.5)
LED.value(1)
#Main program
import machine
import time
LED = machine.Pin(5,machine.Pin.OUT)
rtc = machine.RTC()
rtc.irq(trigger=0, handler=RTC_Timer, wake=machine.DEEPSLEEP)
thank you