-
Notifications
You must be signed in to change notification settings - Fork 2
/
example3.py
40 lines (32 loc) · 741 Bytes
/
example3.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
import matrix
import digits
import urandom
import time
#assign randint function to r
r = urandom.randint
#create matrix class object
s = matrix.matrix
#create digits class object
d = digits
#initialize led matrix
s.init()
#clear led matrix
s.clear_all()
#show changes
s.show()
color = 0
while 1:
#set random active color
s.pixel_color( color )
#write pixmap of random digit to pic variable
pic = d.get_digit( r(0,9), d.digits_center )
#pic = d.get_digit( r(0,9), d.digits_left )
#pic = d.get_digit( r(0,9), d.digits_right )
#write pixmap to led matrix
s.clear_all()
s.pixel_mask( pic )
#show changes
s.show()
#wait some time
time.sleep_ms(1000)
color = color + 5