>>>import machine
>>>rtc=machine.RTC()
>>>rtc.init((2014, 5, 1, 4, 13, 0, 0, 0))
Traceback (most recent call last):
File "<stdin>, line 1, in <module>
AttributeError: ‘RTC’ object has no attribute 'init'
but i did this according here: http://docs.micropython.org/en/latest/e ... e.RTC.html
help,can't init the RTC!
Re: help,can't init the RTC!
The documentation is wrong. You should use the "datetime" method.
Also, the tuple is actually (year, month, day, weekday, hour, minute, second, millisecond).
Also, the tuple is actually (year, month, day, weekday, hour, minute, second, millisecond).
Code: Select all
>>>import machine
>>>rtc=machine.RTC()
>>>rtc.datetime((2014, 5, 1, 0, 4, 13, 0, 0))
>>>rtc.datetime()
(2014, 5, 1, 0, 4, 13, 0, 0)
-
- Posts: 11
- Joined: Sun May 08, 2016 3:41 pm
Re: help,can't init the RTC!
thank you very much! And i want to study about the RTC and TIMER, how many timers are there in 8266? and where can i find the documentation? the offical documentation is too brief i think.
deshipu wrote:The documentation is wrong. You should use the "datetime" method.
Also, the tuple is actually (year, month, day, weekday, hour, minute, second, millisecond).
Code: Select all
>>>import machine >>>rtc=machine.RTC() >>>rtc.datetime((2014, 5, 1, 0, 4, 13, 0, 0)) >>>rtc.datetime() (2014, 5, 1, 0, 4, 13, 0, 0)
-
- Posts: 11
- Joined: Sun May 08, 2016 3:41 pm
Re: help,can't init the RTC!
What is "weekday" mean?
deshipu wrote:The documentation is wrong. You should use the "datetime" method.
Also, the tuple is actually (year, month, day, weekday, hour, minute, second, millisecond).
Code: Select all
>>>import machine >>>rtc=machine.RTC() >>>rtc.datetime((2014, 5, 1, 0, 4, 13, 0, 0)) >>>rtc.datetime() (2014, 5, 1, 0, 4, 13, 0, 0)
Re: help,can't init the RTC!
"Weekday" is the day of the week. I think 0 is Sunday, 1 is Monday, etc. You can just put 0 in there every time, it will be calculated correctly.
If something is not described in the documentation, then your only other option is to look into the source code.
If something is not described in the documentation, then your only other option is to look into the source code.
Re: help,can't init the RTC!
Hello all together,
I had today (one year later) the same problem.
Wouldn't it be fine if the MicroPython documentation could be hold more up to date?
And in which source code should we take a look? In the c source of the github project?
https://github.com/micropython/micropyt ... hine_rtc.c
Thanks a lot in advance.
Best regards, Uwe
I had today (one year later) the same problem.
Wouldn't it be fine if the MicroPython documentation could be hold more up to date?
And in which source code should we take a look? In the c source of the github project?
https://github.com/micropython/micropyt ... hine_rtc.c
Thanks a lot in advance.
Best regards, Uwe
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: help,can't init the RTC!
I suggest you look at ntptime.py in esp8266/modules.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: help,can't init the RTC!
Am I correct in assuming that the main documentation is for PyBoard (or some other) only and other boards have branches that may have several differences in the implementation?