
UiFlow 使用教程
设置不同时区,并显示实时时钟到串口(年月日时分秒星期)
from m5stack import *
from m5stack_ui import *
from uiflow import *
import time
rtc.settime('ntp', host='cn.pool.ntp.org', tzone=8)
while True:
  print(rtc.datetime()[0])
  print(rtc.datetime()[1])
  print(rtc.datetime()[2])
  print(rtc.datetime()[3])
  print(rtc.datetime()[4])
  print(rtc.datetime()[5])
  print(rtc.datetime()[6])
  wait(1)
  wait_ms(2) rtc.settime('ntp', host='cn.pool.ntp.org', tzone=8) 通过 NTP(网络时间协议)主机服务器来设置时间,并根据时区进行调整。你可以选择以下 NTP 服务器:
cn.pool.ntp.org:中国区 NTP 服务器
jp.pool.ntp.org:日本区 NTP 服务器
sg.pool.ntp.org:新加坡区 NTP 服务器
tw.pool.ntp.org:台湾区 NTP 服务器
hk.pool.ntp.org:香港区 NTP 服务器
us.pool.ntp.org:美国区 NTP 服务器
de.pool.ntp.org:德国区 NTP 服务器
str(rtc.datetime()[0]) str(rtc.datetime()[1]) str(rtc.datetime()[2]) str(rtc.datetime()[3]) str(rtc.datetime()[4) str(rtc.datetime()[5) str(rtc.datetime()[6) rtc.datetime((0, 1, 1, 0, 0, 0, 0, 0)) str(rtc.datetime()) str(rtc.printRTCtime())