Code: Select all
import machine
rtc = machine.RTC()
rtc.init((2014, 5, 1, 4, 13, 0, 0, 0))
print(rtc.now())
I am using a bare ESP8266, with "MicroPython v1.8.6-7-gefd0927 on 2016-11-10; ESP module with ESP8266"
Code: Select all
import machine
rtc = machine.RTC()
rtc.init((2014, 5, 1, 4, 13, 0, 0, 0))
print(rtc.now())
Finally, after I read some more general websites about Python, I learnt that I can do the following:deshipu wrote:That documentation is for MicroPython on the WiPy board. The ESP8266 board has an RTC class too, but it's undocumented.
I once noticed the discrepancies and wanted to update the documentation to match what is there on ESP8266 (the pull request is at https://github.com/micropython/micropyt ... 2334/files), however, that would break the WiPy docs.
Code: Select all
>>> help(machine.RTC)
object <class 'RTC'> is of type type
datetime -- <function>
memory -- <function>
alarm -- <function>
alarm_left -- <function>
irq -- <function>
ALARM0 -- 0
Code: Select all
rtc.alarm(time=10000, repeat=True)
Code: Select all
import machine
rtc = machine.RTC()
rtc.alarm(time=10000, repeat=True)
Code: Select all
rtc.alarm(machine.RTC.ALARM0, 10000)
Code: Select all
rtc.alarm(machine.RTC.ALARM0, 10000, True)