[RTL8722CSM] [RTL8722DM] RTC - 时间显示
材料准备
AmebaD[AMB21 / AMB22] x 1
范例说明
RTC 模组会帮助微控制器来追踪时间,是时间模组必须的一部分。我们在这里有一个示例,来展示如何来得到本地时间和上传时间。
复制下面的代码贴至REPL,观察结果。
1rtc = RTC()
2rtc.datetime() # get date and time
3rtc.datetime((2020, 12, 31, 4, 23, 58, 59, 0)) # set a specific date and time (year, month, day, weekday(0 for Monday), hour, minute, second, total seconds)
4rtc.datetime() # check the updated date and time