>>> from pyb import RTC
>>>help(RTC)
object <class 'RTC'> is of type typeinit --<function>info --<function>datetime --<function>wakeup --<function>calibration --<function>
from pyb import RTC
import time
# 定义星期数组
weekdays =['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']
rtc =RTC()
rtc.datetime((2023,11,28,2,21,10,15,0)) # set a specific date and timeif __name__ =='__main__':while True:#Get the current time from the RTCcurrent_time = rtc.datetime()print(current_time) # get date and timetime.sleep(1)year, month, day,weekday, hour, minute, second, yearday = rtc.datetime()# 获取星期对应的数组成员weekday_name = weekdays[weekday]print("当前时间:{}-{}-{} {}:{}:{} Week:{}".format(year, month, day, hour, minute, second,weekday_name))