-
Notifications
You must be signed in to change notification settings - Fork 9
/
demo.py
49 lines (37 loc) · 976 Bytes
/
demo.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
#! /usr/bin/env python
import sys
import time
from demo import animations
from flipdot import client, display
d = display.Display(28, 14,
panels={
2: ((0, 0), (28, 7)),
1: ((0, 7), (28, 7)),
})
def transition(d):
animations.rand(d)
def mainloop(d):
animations.display_text(d, "YO!")
time.sleep(2)
transition(d)
animations.blink_text(d, "HI!")
time.sleep(1)
transition(d)
animations.scroll_text(d, "This is scrolled text.", font=animations.SmallFont)
time.sleep(0.5)
transition(d)
d.reset()
d.send()
def main():
if len(sys.argv) > 1 and sys.argv[1] == "udp":
d.connect(client.UDPClient("localhost", 9999))
else:
d.connect(client.SerialClient('/dev/ttyUSB1'))
try:
# intro(d)
while True:
mainloop(d)
finally:
d.disconnect()
if __name__ == "__main__":
main()