Example explanation-02-rtc real-time clock

# RTC 例子
#
# 这个例子展示了如何使用OpenMV的RTC
import time
from pyb import RTC

rtc = RTC()
rtc.datetime((2013, 7, 9, 2, 0, 0, 0, 0))

while (True):
    print(rtc.datetime())
    time.sleep_ms(1000)

Singtown Technology OpenMV official Chinese document function explanation:

The pyb module cannot be used on OpenMV RT, only the following machine module can be used:

# RTC 例子
#
# 这个例子展示了如何使用OpenMV的RTC
import time
from machine import RTC

rtc = RTC()

# 将此注释掉以初始化 RTC 时间和日期。 
# 执行此操作后,RTC 将保留时间,直到系统完全断电。
# rtc.init((2023, 8, 8, 14, 15, 0, 0, 0))

while True:
    time.sleep_ms(100)
    print(rtc.now())

results matching ""

    No results matching ""