Add main.py

This commit is contained in:
Artur Kerge 2023-09-20 18:06:16 +00:00
parent 119e08bc5a
commit a12654c786

71
main.py Normal file
View File

@ -0,0 +1,71 @@
import humanize
from datetime import datetime
from display import DisplayBuffer, Font
from time import sleep
import serial
port = serial.serial_for_url("/dev/ttyUSB0", baudrate=4800)
#port = serial.serial_for_url("/dev/ttyUSB0", baudrate=2400)
disp = DisplayBuffer(0x06, 128, 16)
#disp = DisplayBuffer(0x10, 28, 13)
#while True:
deadline = datetime(2023, 7, 30, 14-3, 0)
#td = str(deadline - datetime.utcnow()).split(".")[0]
#raise
disp.put_text(b"", 3, 4, Font.F6)
buf = disp.finalize_buffer()
port.write(buf)
sleep(1)
disp.put_text(b"Mechanical keyboard", 4, 4, Font.F6)
disp.put_text(b"meetup", 40, 15, Font.F6)
buf = disp.finalize_buffer()
port.write(buf)
sys.exit(0)
if True:
#while True:
#i = datetime.strftime(datetime.now(), " %H:%M:%S")
#j = datetime.strftime(datetime.now(), " %Y-%m-%d %A")
#i = "Kuberneedus workshop"
#j = ""
#disp.put_text(i.encode("ascii"), 3, 11, Font.F6)
i = "Stateful workloads on"
j = "Kubernetes"
i = "Cloud native Node.js"
j = "Erki Aas"
i = "Welcome to"
j = "k-space.ee"
"""
td = deadline - datetime.utcnow()
print(dir(td))
msg = "%d days %d hours %d mins" % (td.days, td.seconds // 3600, (td.seconds % 3600) // 60)
disp.put_text("Hackathon countdown".encode("ascii"), 0, 4, Font.F6)
disp.put_text(msg.encode("ascii"), 0, 15, Font.F6)
"""
# i = "Cloud native"
# j = "Rainer Aus"
# i = "GitOps with Argo CD"
# j = "Lauri Vosandi"
# disp.put_text(i.encode("ascii"), 10, 4, Font.F6)
# disp.put_text(j.encode("ascii"),23, 15, Font.F6)
# disp.put_text(b'"!!"!', 57, 11, Font.BITMAP)
# i = "On-prem Kubernetes"
# j = "Sander Kuusemets"
# disp.put_text(i.encode("ascii"), 6, 4, Font.F6)
# disp.put_text(j.encode("ascii"), 11, 15, Font.F6)
# i = "networking"
# disp.put_text(i.encode("ascii"), 61, 4, Font.F6)
buf = disp.finalize_buffer()
port.write(buf)
sleep(60)
port.close()