-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtimedate.py
50 lines (46 loc) · 1.25 KB
/
timedate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env python
# name = "timedate",
# version = "0.0.1",
# author = "Marshall Baer",
# author_email = "[email protected]",
# description = ("A simple clock + date"),
# license = "MIT"
import max7219.led as led
import datetime
import time
from max7219.font import proportional, SINCLAIR_FONT, TINY_FONT, CP437_FONT
from random import randrange
device = led.matrix(cascaded=4)
device.orientation(90)
device.brightness(1)
while(True):
clock = time.strftime("%H%M")
seconds = int(time.strftime("%S"))
month = time.strftime(" %m")
day = time.strftime(" %d")
year = time.strftime("%Y")
for n, c in enumerate(clock):
device.letter(n, ord(c))
if seconds == 59 :
for row in range(8):
device.scroll_up()
time.sleep(0.1)
for n, c in enumerate(month):
device.letter(n, ord(c))
time.sleep(1)
for row in range(8):
device.scroll_down()
time.sleep(0.1)
for n, c in enumerate(day):
device.letter(n, ord(c))
time.sleep(1)
for row in range(8):
device.scroll_down()
time.sleep(0.1)
for n, c in enumerate(year):
device.letter(n, ord(c))
time.sleep(1)
for row in range(8):
device.scroll_down()
time.sleep(0.1)
#device.show_message(time.strftime("%b %d %Y"))