https://learn.adafruit.com/adafruit-fea ... ah-esp8266
https://learn.adafruit.com/adafruit-ada ... g/overview
Adafruit has the uRTC code here:
https://github.com/adafruit/Adafruit-uRTC
When I set the rtc datetime with a two digit day, i.e. 2016-12-17, day displays as 7 when recalled. I think this is a bug but would appreciate some assistance identifying the issue before I try to modify the uRTC code.
When I set the day to a single digit, i.e. 2016-12-3, reading datetime from the rtc appears correct. Here is a screenlog from my REPL session, showing micropython version. I have added some white space to enhance readability.
Thanks,
J
Code: Select all
WebREPL daemon started on ws://192.168.4.1:8266
WebREPL daemon started on ws://0.0.0.0:8266
Started webrepl in normal mode
connecting to network...
network config: ('192.168.1.113', '255.255.255.0', '192.168.1.1', '192.168.1.1')
MicroPython v1.8.6-150-gd9c8397 on 2016-12-12; ESP module with ESP8266
Type "help()" for more information.
>>> import urtc
>>> from machine import I2C, Pin
>>> i2c = I2C(scl=Pin(5), sda=Pin(4))
>>> rtc = urtc.PCF8523(i2c)
>>> datetime = urtc.datetime_tuple(year=2016, month=12, day=17, weekday=6, hour=14, minute=4, second=0, millisecond=0)
>>> rtc.datetime(datetime)
>>> rtc.datetime()
DateTimeTuple(year=2016, month=12, day=7, weekday=6, hour=14, minute=4, second=10, millisecond=0)
>>> rtc.datetime()
DateTimeTuple(year=2016, month=12, day=7, weekday=6, hour=14, minute=4, second=17, millisecond=0)
>>> datetime = urtc.datetime_tuple(year=2016, month=12, day=3, weekday=6, hour=14, minute=4, second=0, millisecond=0)
>>> rtc.datetime(datetime)
>>> rtc.datetime()
DateTimeTuple(year=2016, month=12, day=3, weekday=6, hour=14, minute=4, second=15, millisecond=0)
>>> rtc.datetime()
DateTimeTuple(year=2016, month=12, day=3, weekday=6, hour=14, minute=5, second=13, millisecond=0)