i try of setup init RTC with :
Code: Select all
import machine
rtc=machine.RTC()
rtc.init((2014, 5, 1, 4, 13, 0, 0, 0))
what is the right way to do it?TypeError: function takes 1 positional arguments but 2 were given
thank you
Code: Select all
import machine
rtc=machine.RTC()
rtc.init((2014, 5, 1, 4, 13, 0, 0, 0))
what is the right way to do it?TypeError: function takes 1 positional arguments but 2 were given
Code: Select all
$ picocom -q -b115200 /dev/cu.usbmodem3167336E34362
MicroPython v1.12-464-gcae77daf0-dirty on 2020-05-24; VCC-GND STM32F407ZG with STM32F407ZG
Type "help()" for more information.
>>> import machine
>>> rtc=machine.RTC()
>>> rtc.datetime()
(2015, 1, 1, 4, 0, 0, 0, 255)
>>> rtc.datetime((2014, 5, 1, 4, 13, 0, 0, 0))
>>> rtc.datetime()
(2014, 5, 1, 4, 13, 0, 3, 255)
>>>
Code: Select all
>>> dir(rtc)
['__class__', 'calibration', 'datetime', 'info', 'init', 'wakeup']
>>> rtc.datetime(1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: object 'int' isn't a tuple or list
>>> rtc.datetime((1,2))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: requested length 8 but object has length 2
>>>