-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathloadimage.py
79 lines (48 loc) · 1.46 KB
/
loadimage.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import display
import time
# See https://www.penguintutor.com/programming/picodisplayanimations
# This is based on a binary image file (RGB565) with the same dimensions as the screen
# updates the global display_buffer directly
def blit_image_file (filename):
position = 0
blocksize = 1024
with open (filename, "rb") as file:
chunk = file.read(blocksize)
while chunk:
#print(position)
LCD.buffer[position:position+len(chunk)] = chunk
chunk = file.read(blocksize)
position = position + len(chunk)
LCD = display.Display()
for d in range(0,6):
LCD.select_digit(d)
LCD.fill(LCD.white)
LCD.show()
print("Loading")
print("displaying")
starttime = time.ticks_ms()
LCD.select_digit(0)
blit_image_file ("0.raw")
LCD.show()
LCD.select_digit(1)
blit_image_file ("1.raw")
LCD.rect(0,0,240,135,LCD.white)
LCD.rect(1,1,238,133,LCD.white)
LCD.rect(2,2,236,131,LCD.white)
LCD.rect(3,3,234,129,LCD.white)
LCD.show()
LCD.select_digit(2)
blit_image_file ("2.raw")
LCD.show()
LCD.select_digit(3)
blit_image_file ("3.raw")
LCD.show()
LCD.select_digit(4)
blit_image_file ("4.raw")
LCD.show()
LCD.select_digit(5)
blit_image_file ("5.raw")
LCD.show()
endtime = time.ticks_ms()
print("time = {0} milliseconds".format(endtime - starttime));
# Do nothing - but continue to display the image