pdf-icon

UIFlow 上手教程

UiFlow1 Blockly

Event

Unit

UiFlow1 项目配置

Unit RTC

案例程序

设置时钟

from m5stack import *
from m5stack_ui import *
from uiflow import *
import unit

screen = M5Screen()
screen.clean_screen()
screen.set_screen_bg_color(0xFFFFFF)
rtc_0 = unit.get(unit.RTC8563, unit.PORTA)

rtc_0.set_date_time(37, 1, 1, 1, 0, 0, 0)
while True:
  print((str('hours') + str((rtc_0.get_date_time(2)))))
  print((str('minutes:') + str((rtc_0.get_date_time(1)))))
  print((str('seconds:') + str((rtc_0.get_date_time(0)))))
  wait_ms(2)

功能说明

print((str('alarm flag:') + str((rtc_0.check_alarm_flag()))))
  • 检查闹钟标志位
print((str('flag:') + str((rtc_0.check_timer_flag()))))
  • 检查定时器标志位
rtc_0.clear_alarm_flag()
  • 清除闹钟
rtc_0.clear_timer_flag()
  • 清除定时器标志位
rtc_0.disable_alarm()
  • 禁用闹钟
rtc_0.disable_timer()
  • 禁用定时器
print((str('rtc:') + str((rtc_0.get_date_time(0)))))
  • 获取日期时间
print((str('value:') + str((rtc_0.get_timer_value()))))
  • 获取定时器当前值
rtc_0.pause_timer()
  • 暂停定时器
rtc_0.resume_timer()
  • 恢复定时器运行
rtc_0.set_alarm_clock(1, 0, 0)
  • 设置闹钟
rtc_0.set_date_time(0, 1, 1, 1, 0, 0, 0)
  • 设置日期时间
rtc_0.set_timer_mode(0, 0)
  • 设置定时器工作模式
On This Page