2021-05-10 10:23:27 +00:00
|
|
|
from breakout_rtc import BreakoutRTC
|
2021-05-17 13:50:49 +00:00
|
|
|
import time
|
2021-05-10 10:23:27 +00:00
|
|
|
|
2021-05-17 13:50:49 +00:00
|
|
|
# rtc = BreakoutRTC(sda=4, scl=5) # i2c pins 4, 5 for Breakout Garden
|
|
|
|
rtc = BreakoutRTC() # Default i2c pins for Pico Explorer
|
2021-05-10 10:23:27 +00:00
|
|
|
|
|
|
|
if rtc.is_12_hour():
|
|
|
|
rtc.set_24_hour()
|
|
|
|
|
|
|
|
rtc.enable_periodic_update_interrupt(True)
|
|
|
|
|
|
|
|
while True:
|
|
|
|
if rtc.read_periodic_update_interrupt_flag():
|
|
|
|
rtc.clear_periodic_update_interrupt_flag()
|
|
|
|
|
|
|
|
if rtc.update_time():
|
2021-05-17 13:50:49 +00:00
|
|
|
rtc_date = rtc.string_date()
|
|
|
|
rtc_time = rtc.string_time()
|
|
|
|
print("Date: ", rtc_date, ", Time: ", rtc_time, sep="")
|
|
|
|
|
|
|
|
time.sleep(0.1)
|