Hi all. I’ve cobbled together a clock script for the Microdot pHat. The display is used “upside-down” so I can stand it vertically, and the hours:minutes separator is a blinking colon drawn as text (rather than using the built-in dot separators). This is the code:
#!/usr/bin/env python import datetime import time from microdotphat import write_string, clear, show, set_rotate180 set_rotate180(True) while True: clear() t = datetime.datetime.now() write_string(t.strftime("%H:%M"), kerning=False) show() time.sleep(1.0) clear() write_string(t.strftime("%H %M"), kerning=False) show() time.sleep(1.0)
It works perfectly well but it seems quite clunky to me. I’d have thought there’d be a way to draw the time only once and have the colon blink independently, but it’s possible I’m not asking Google the right questions, as I haven’t been able to find a solution. Does anyone have any ideas on how to improve efficiency?
Thanks in advance.