You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

36 lines
1.0 KiB

import ntptime
ntptime.settime()
from flipdisc import DisplayBuffer, Font
from time import sleep, localtime
from machine import UART
TIMEZONE = 3
weekdays = "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"
port = UART(2, baudrate=4800, tx=17, rx=16)
disp = DisplayBuffer(0x06, 128, 16)
while True:
for j in range(0,10):
year, month, day, hour, minute, second, dow, _ = localtime()
hour = (hour + TIMEZONE) % 24
i = " %02d:%02d:%02d" % (hour, minute, second)
j = " %04d-%02d-%02d %s" % (year, month, day, weekdays[dow])
disp.put_text(i.encode("ascii"),0, 0, Font.F6)
disp.put_text(j.encode("ascii"),0, 15, Font.F6)
buf = disp.finalize_buffer()
port.write(buf)
sleep(1)
for j in range(0, 2):
disp.put_text(b"MicroPython",0, 0, Font.F13_F)
buf = disp.finalize_buffer()
port.write(buf)
sleep(2)
disp.put_text(b"... is awesome",0, 0, Font.F13_F)
buf = disp.finalize_buffer()
port.write(buf)
sleep(2)
port.close()