
UiFlow 使用教程
通过网络服务器读取当前时间, 注: 当程序 download 离线运行时,需要在 NTP 初始化程序前,添加 WiFi 连接程序,使得设备连接网络。
from m5stack import *
from m5ui import *
from uiflow import *
import ntptime
import time
setScreenColor(0x222222)
ntp = ntptime.client(host='cn.pool.ntp.org', timezone=8)
while True:
print(ntp.formatDatetime('-', ':'))
print(ntp.getTimestamp())
wait(1)
wait_ms(2) import ntptime
ntp = ntptime.client(host='cn.pool.ntp.org', timezone=8) cn.pool.ntp.orgjp.pool.ntp.orgsg.pool.ntp.orgtw.pool.ntp.orghk.pool.ntp.orgus.pool.ntp.orgde.pool.ntp.orgntp.formatDate('-') ntp.formatTime(':') ntp.formatDatetime('-', ':') ntp.getTimestamp() ntp.year() ntp.month() ntp.weekday() ntp.day() ntp.hour() ntp.minute() ntp.second()