File tree Expand file tree Collapse file tree 2 files changed +107
-0
lines changed Expand file tree Collapse file tree 2 files changed +107
-0
lines changed Original file line number Diff line number Diff line change 1+ """ACTIVITY GENERATOR for Adafruit CLUE"""
2+
3+ import time
4+ import random
5+ from adafruit_clue import clue
6+ from things import activities
7+ from things import subjects
8+
9+ screen = clue .simple_text_display (text_scale = 4 , colors = (clue .WHITE ,))
10+
11+ screen [1 ].text = "ACTIVITY"
12+ screen [2 ].text = "GENERATOR"
13+ screen .show ()
14+ time .sleep (1.5 )
15+
16+ screen [0 ].text = "make a"
17+ screen [2 ].text = "about"
18+ screen [1 ].color = clue .RED
19+ screen [3 ].color = clue .GREEN
20+ screen [4 ].color = clue .BLUE
21+
22+ activity = "???"
23+ subject_a = "???"
24+ subject_b = "???"
25+ two_subjects = True
26+
27+ def random_pick (items ):
28+ index = random .randint (0 , len (items )- 1 )
29+ return items [index ]
30+
31+ while True :
32+
33+ if clue .button_a :
34+ activity = random_pick (activities )
35+ subject_a = random_pick (subjects )
36+ subject_b = random_pick (subjects )
37+ time .sleep (0.25 )
38+ if clue .button_b :
39+ two_subjects = not two_subjects
40+ time .sleep (0.5 )
41+
42+ screen [1 ].text = activity
43+ screen [3 ].text = subject_a
44+
45+ if two_subjects :
46+ screen [4 ].text = subject_b
47+ else :
48+ screen [4 ].text = ""
49+
50+ screen .show ()
Original file line number Diff line number Diff line change 1+ activities = [
2+ "DRAWING" ,
3+ "SONG" ,
4+ "STORY" ,
5+ "VIDEO" ,
6+ ]
7+
8+ subjects = [
9+ "COMPUTER" ,
10+ "ALIEN" ,
11+ "LASER" ,
12+ "FOOD" ,
13+ "TREE" ,
14+ "DREAM" ,
15+ "WEATHER" ,
16+ "DOG" ,
17+ "CAT" ,
18+ "BIRD" ,
19+ "HORSE" ,
20+ "BLANKET" ,
21+ "TIME" ,
22+ "PLANT" ,
23+ "LEAF" ,
24+ "EAR" ,
25+ "HAND" ,
26+ "FEET" ,
27+ "TEETH" ,
28+ "PHONE" ,
29+ "SPACE" ,
30+ "ROBOT" ,
31+ "GHOST" ,
32+ "FUTURE" ,
33+ "PROBLEM" ,
34+ "MUSIC" ,
35+ "NOISE" ,
36+ "METAL" ,
37+ "ROCK" ,
38+ "AIR" ,
39+ "HOPE" ,
40+ "FEAR" ,
41+ "LOVE" ,
42+ "DANGER" ,
43+ "COOKIE" ,
44+ "BREAD" ,
45+ "WATER" ,
46+ "HAT" ,
47+ "ROUND" ,
48+ "SQUARE" ,
49+ "SUCCESS" ,
50+ "LIGHT" ,
51+ "RUNNING" ,
52+ "TALKING" ,
53+ "SLEEPING" ,
54+ "FLYING" ,
55+ "SINGING" ,
56+ "ACTING" ,
57+ ]
You can’t perform that action at this time.
0 commit comments