The immediate cause of your problem is that the line
Code: Select all
rtc_i = rtc.irq(trigger=machine.RTC.ALARM0, handler=alarm_handler, wake=machine.idle)
should read
Code: Select all
rtc_i = rtc.irq(trigger=machine.RTC.ALARM0, handler=alarm_handler, wake=machine.IDLE)
machine.idle is a function, machine.IDLE is a constant.
Alas I still can't make it work. There seem to be several issues with the firmware, at least with the build I have (27th Nov). Several constants are missing from the machine module (including IDLE). And there also seems to be a problem with the rtc.irq() method which objects to the handler arg. I will raise an issue on Github.
There is another point to note here. The docs
http://docs.micropython.org/en/latest/e ... chine.html indicate that machine.idle() may wake milliseconds later due to an interrupt being received. In my testing this seems to happen. machine.sleep() gives a "not yet implemented" error. So you may have to use deepsleep.