Skip to content

Commit d25ab3b

Browse files
committed
Refine examples
1 parent 3d4bbfb commit d25ab3b

File tree

8 files changed

+63
-61
lines changed

8 files changed

+63
-61
lines changed
Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,13 @@
11
import board
22
import dotstar_featherwing
3-
import time
4-
53

64
wing = dotstar_featherwing.DotstarFeatherwing(board.D13, board.D11)
7-
starfleet = ["XXXXXXX.....",
8-
"..XXXXXXX...",
9-
"....XXXXXXX.",
10-
".....XXXXXXX",
11-
"....XXXXXXX.",
12-
"..XXXXXXX..."]
13-
14-
wing.display_image(starfleet, (0x20, 0x20, 0x00))
15-
16-
time.sleep(5)
17-
18-
xmas = ["..y.w......w",
19-
"..G.....w...",
20-
"..G..w....w.",
21-
".GGG...w....",
22-
"GGGGG.......",
23-
"wwwwwwwwwwww"]
24-
25-
xmas_colors = {'w': (0x20, 0x20, 0x20),
26-
'W': (0xFF, 0xFF, 0xFF),
27-
'G': (0x00, 0x20, 0x00),
28-
'y': (0x20, 0x20, 0x00),
29-
'Y': (0xFF, 0xFF, 0x00)}
30-
31-
wing.display_colored_image(xmas, xmas_colors)
32-
33-
time.sleep(5)
345

6+
xmas_colors = {'w': ( 32, 32, 32),
7+
'W': (255, 255, 255),
8+
'G': ( 0, 32, 0),
9+
'y': ( 32, 32, 0),
10+
'Y': (255, 255, 0)}
3511

3612
xmas_animation = [["..y.w......w",
3713
"..G.....w...",
@@ -64,6 +40,4 @@
6440
"GGGGG......W",
6541
"wwwwwwwwwwww"]]
6642

67-
while True:
68-
wing.display_animation(xmas_animation, xmas_colors, 10, 0.05)
69-
43+
wing.display_animation(xmas_animation, xmas_colors, 10, 0.05)

examples/color_image/main.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import board
2+
import dotstar_featherwing
3+
4+
wing = dotstar_featherwing.DotstarFeatherwing(board.D13, board.D11)
5+
6+
xmas = ["..y.w......w",
7+
"..G.....w...",
8+
"..G..w....w.",
9+
".GGG...w....",
10+
"GGGGG.......",
11+
"wwwwwwwwwwww"]
12+
13+
xmas_colors = {'w': ( 32, 32, 32),
14+
'G': ( 0, 32, 0),
15+
'y': ( 32, 32, 0)}
16+
17+
wing.display_colored_image(xmas, xmas_colors)

examples/count_from_left/main.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66

77
# count from 0->63, shifting the binary pattern in from the left
88
while True:
9-
wing.clear()
10-
for x in range(64):
11-
wing.shift_into_left(wing.number_to_pixels(x, (0x40, 0x00, 0x00)))
12-
time.sleep(0.2)
13-
9+
wing.clear()
10+
for x in range(64):
11+
wing.shift_into_left(wing.number_to_pixels(x, (64, 0, 0)))
12+
time.sleep(0.2)

examples/count_from_right/main.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66

77
# count from 0->63, shifting the binary pattern in from the right
88
while True:
9-
wing.clear()
10-
for x in range(64):
11-
wing.shift_into_right(wing.number_to_pixels(x, (0x40, 0x00, 0x00)))
12-
time.sleep(0.2)
13-
9+
wing.clear()
10+
for x in range(64):
11+
wing.shift_into_right(wing.number_to_pixels(x, (64, 0, 0)))
12+
time.sleep(0.2)

examples/dots/main.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
wing.show()
1010

1111
while True:
12-
row = random.randint(0, 5)
13-
column = random.randint(0, 11)
14-
color = (random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))
15-
wing.set_color(row, column, color)
16-
row = random.randint(0, 5)
17-
column = random.randint(0, 11)
18-
wing.set_color(row, column, (0, 0, 0))
19-
wing.show()
12+
row = random.randint(0, 5)
13+
column = random.randint(0, 11)
14+
color = (random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))
15+
wing.set_color(row, column, color)
16+
row = random.randint(0, 5)
17+
column = random.randint(0, 11)
18+
wing.set_color(row, column, (0, 0, 0))
19+
wing.show()

examples/fill/main.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
import time
44
import random
55

6-
wing = dotstar_featherwing.DotstarFeatherwing(board.D13, board.D11, brightness=0.1)
6+
wing = dotstar_featherwing.DotstarFeatherwing(board.D13, board.D11, 0.25)
77

88
wing.clear()
99
wing.show()
1010

1111
while True:
12-
color = (random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))
13-
wing.fill(color)
14-
wing.show()
15-
time.sleep(0.25)
16-
wing.clear()
17-
wing.show()
18-
time.sleep(0.25)
12+
color = (random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))
13+
wing.fill(color)
14+
wing.show()
15+
time.sleep(0.25)
16+
wing.clear()
17+
wing.show()
18+
time.sleep(0.25)

examples/monochrome_image/main.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import board
2+
import dotstar_featherwing
3+
4+
wing = dotstar_featherwing.DotstarFeatherwing(board.D13, board.D11)
5+
6+
starfleet = ["XXXXXXX.....",
7+
"..XXXXXXX...",
8+
"....XXXXXXX.",
9+
".....XXXXXXX",
10+
"....XXXXXXX.",
11+
"..XXXXXXX..."]
12+
13+
wing.display_image(starfleet, (32, 32, 32))

examples/shifting_in_string/main.py renamed to examples/text/main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
wing = dotstar_featherwing.DotstarFeatherwing(board.D13, board.D11, 0.1)
77

88
while True:
9-
wing.clear()
10-
wing.shift_in_string(font3.font, "hello adafruit discord!", (0x20, 0x00, 0x20), 0.05)
11-
time.sleep(2)
9+
wing.clear()
10+
wing.shift_in_string(font3.font, "hello adafruit discord!", (32, 32, 32), 0.05)
11+
time.sleep(2)

0 commit comments

Comments
 (0)