-
Notifications
You must be signed in to change notification settings - Fork 0
/
animated_bitmap.py
49 lines (37 loc) · 1.04 KB
/
animated_bitmap.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
import Image
import time
import math
import arduino_lights as al
ser = al.connect()
def render_image(image_path):
img = Image.open("images/" + image_path)
rgb_im = img.convert('RGB')
size = 12, 12
sleep_time = 0.002
al.end_frame(ser)
print "time per frame: " + str(sleep_time * 144) + "s"
for x in range(12):
for y in range(12):
r, g, b = rgb_im.getpixel((x, y))
al.set_pixel(ser, (x, y), r, g, b)
test = True
baseball = True
cat = False
dude = False
while(True):
if test:
for n in range(25):
render_image("testy_test/" + str(n) + ".bmp")
time.sleep(0.5)
if baseball:
for n in range(10):
render_image("baseball/baseball-" + str(n) + ".bmp")
time.sleep(0.1)
if cat:
for n in range(4):
render_image("cat/cat-" + str(n) + ".bmp")
time.sleep(0.2)
if dude:
for n in range(28):
render_image("tiny_dude/tiny_dude-" + str(n) + ".bmp")
time.sleep(0.05)