from machine import RTC, SPI, Pin
import utime
import # Replace with your specific e-paper display driver
# Initialize RTC (uses internal RTC of Pico W)
rtc = RTC()
rtc.datetime((2024, 12, 10, 2, 12, 0, 0, 0)) # (year, month, day, weekday, hour, minute, second, millisecond)
# Initialize SPI for e-paper
spi = SPI(1, baudrate=2000000, polarity=0, phase=0,
sck=Pin(18), mosi=Pin(23), miso=Pin(19)) # Adjust pins for your setup
cs = Pin(5)
dc = Pin(15)
rst = Pin(16)
busy = Pin(17)
# Initialize e-paper display
epd = epd2in13.EPD(spi, cs, dc, rst, busy)
epd.init()
def display_time():
while True:
# Get the current time
datetime = rtc.datetime()
current_time = "{:02}:{:02}:{:02}".format(datetime[4], datetime[5], datetime[6])
# Prepare the display
epd.clear_frame_memory(0xFF) # Clear the frame with white
epd.set_frame_memory_text("Current Time:", x=10, y=10, font_size=16)
epd.set_frame_memory_text(current_time, x=10, y=30, font_size=24)
epd.display_frame()
utime.sleep(60) # Update every minute
try:
display_time()
except KeyboardInterrupt:
print("Clock stopped.")
epd.sleep()
Loading
epaper-2in9
epaper-2in9