forked from stephenangelico/twitchpixelpi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain2.py
More file actions
223 lines (205 loc) · 10 KB
/
main2.py
File metadata and controls
223 lines (205 loc) · 10 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
#This is the main. This meeds to import function_library.py in order to work.
#Import the 'functions_library' which animates the LEDs in various ways.
from function_library import *
#Main program logic:
if __name__ == '__main2__':
#Process arguments
opt_parse()
#Create NeoPixel object with appropriate configuration.
strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL, LED_STRIP)
#Intialize the library (must be called once before other functions).
strip.begin()
print ('Press Ctrl-C to quit.')
def neo_loop1():
#Process arguments
opt_parse()
#Create NeoPixel object with appropriate configuration.
strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL, LED_STRIP)
#Intialize the library (must be called once before other functions).
strip.begin()
print("Calling: Cylon(strip, 255, 0, 0, 3, .1, .5)")
for i in range (5):
Cylon(strip, (random.randrange(0, 255)), (random.randrange(0, 255)), (random.randrange(0, 255)), 7, .05, .01)
def neo_loop2():
#Process arguments
opt_parse()
#Create NeoPixel object with appropriate configuration.
strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL, LED_STRIP)
#Intialize the library (must be called once before other functions).
strip.begin()
print("Calling: TheaterChaseRainbow(strip, .1)")
TheaterChaseRainbow(strip, .1)
def blank():
#Process arguments
opt_parse()
#Create NeoPixel object with appropriate configuration.
strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL, LED_STRIP)
#Intialize the library (must be called once before other functions).
strip.begin()
print("Calling: Blank(strip)")
Blank(strip)
def neo_loop3():
#Process arguments
opt_parse()
#Create NeoPixel object with appropriate configuration.
strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL, LED_STRIP)
#Intialize the library (must be called once before other functions).
strip.begin()
t_end = time.time() + 60 * 1
print("Calling: Strobe(strip, 255, 255, 255, 5, .25, 3)")
Strobe(strip, 200, 200, 200, 20, .15, 3)
print("Calling: Blank(strip)")
Blank(strip)
def neo_loop4():
#Process arguments
opt_parse()
#Create NeoPixel object with appropriate configuration.
strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL, LED_STRIP)
#Intialize the library (must be called once before other functions).
strip.begin()
print("Calling: RunningLights(strip, 255, 255, 255, .25)")
RunningLights(strip, (random.randrange(0, 125, 15)), (random.randrange(0, 125, 15)), (random.randrange(0, 125, 15)), .1)
Blank(strip)
def neo_loop5():
#Process arguments
opt_parse()
#Create NeoPixel object with appropriate configuration.
strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL, LED_STRIP)
#Intialize the library (must be called once before other functions).
strip.begin()
print("Calling: Cops(strip, 5, .5, 3)")
Cops(strip, 5, .5, 3)
Blank(strip)
def neo_loop6():
#Process arguments
opt_parse()
#Create NeoPixel object with appropriate configuration.
strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL, LED_STRIP)
#Intialize the library (must be called once before other functions).
strip.begin()
print("Calling: Fire(strip, Heat, 75, 150, .015) #This looks a lot better looped...")
for i in range (300):
Fire(strip, Heat, 75, 150, .015)
Blank(strip)
def neo_loop7():
#Process arguments
opt_parse()
#Create NeoPixel object with appropriate configuration.
strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL, LED_STRIP)
#Intialize the library (must be called once before other functions).
strip.begin()
print("Calling: MorseCode(strip, 255, 255, 255, 'SOS. This is a test.', .15)")
MorseCode(strip, 255, 255, 255, 'Phr3d13', .15)
Blank(strip)
def neo_loop8():
#Process arguments
opt_parse()
#Create NeoPixel object with appropriate configuration.
strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL, LED_STRIP)
#Intialize the library (must be called once before other functions).
strip.begin()
print("Calling: SnowSparkle(strip, 10, 10, 10, .1, random.uniform(0, .5))")
for i in range (30):
SnowSparkle(strip, 10, 10, 10, .1, random.uniform(0, .5))
Blank(strip)
def neo_loop9():
#Process arguments
opt_parse()
#Create NeoPixel object with appropriate configuration.
strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL, LED_STRIP)
#Intialize the library (must be called once before other functions).
strip.begin()
print("Calling: NewKitt(strip, 255, 0, 0, 8, .01, .05)")
NewKitt(strip, random.randint(0, 150), random.randint(0, 150), random.randint(0, 150), 8, .1, .1)
Blank(strip)
"""
while True:
print("Calling: FadeRGB(strip)")
FadeRGB(strip)
print("Calling: FadeInOut(strip, 255, 255, 255)")
FadeInOut(strip, 255, 255, 255)
print("Calling: Strobe(strip, 255, 255, 255, 5, .5, 3)")
Strobe(strip, 255, 255, 255, 5, .5, 3)
print("Calling: Cylon(strip, 255, 0, 0, 3, .1, .5)")
Cylon(strip, 255, 0, 0, 3, .1, .5)
print("Calling: Twinkle(strip, 255, 0, 0, 8, .1, False)")
Twinkle(strip, 255, 0, 0, 8, .1, False)
print("Calling: TwinkleRandom(strip, 8, .1, False)")
TwinkleRandom(strip, 8, .1, False)
print("Calling: Sparkle(strip, 255, 255, 255, 0)")
Sparkle(strip, 255, 255, 255, 0)
print("Calling: SnowSparkle(strip, 10, 10, 10, .1, random.uniform(0, .5))")
SnowSparkle(strip, 10, 10, 10, .1, random.uniform(0, .5))
print("Calling: RunningLights(strip, 255, 255, 255, .25)")
RunningLights(strip, 255, 255, 255, .25)
print("Calling: ColorWipe(strip, 255, 0, 0, .02)")
ColorWipe(strip, 255, 0, 0, .02)
print("Calling: ColorWipeReverse(strip, 0, 255, 0, .02)")
ColorWipeReverse(strip, 0, 255, 0, .02)
print("Calling: Rainbow(strip, 0)")
Rainbow(strip, 0)
print("Calling: RainbowCycle(strip, 5, 0)")
RainbowCycle(strip, 5, 0)
print("Calling: ColorChase(strip, 0, 0, 255, .02)")
ColorChase(strip, 0, 0, 255, .02)
print("Calling: ColorChaseReverse(strip, 0, 255, 0, .02)")
ColorChaseReverse(strip, 0, 255, 0, .02)
print("Calling: TheaterChase(strip, 255, 0, 0, .2, 10)")
TheaterChase(strip, 255, 0, 0, .2, 10)
print("Calling: TheaterChaseRainbow(strip, .1)")
TheaterChaseRainbow(strip, .1)
print("Calling: MeteorRain(strip, 255, 0, 0, 5, 64, True, .1)")
MeteorRain(strip, 255, 0, 0, 5, 64, True, .1)
print("Calling: NewKitt(strip, 255, 0, 0, 8, .01, .05)")
NewKitt(strip, 255, 0, 0, 8, .01, .05)
print("Calling: Fire(strip, Heat, 75, 150, .015) #This looks a lot better looped...")
Fire(strip, Heat, 75, 150, .015) #This looks a lot better looped...
print("Calling: BouncingBalls(strip, 255, 0, 0, 3)")
BouncingBalls(strip, 255, 0, 0, 3)
print("Calling: BouncingBallsRGB(strip, 3, [[255, 0, 0], [0, 255, 0], [0, 0, 255]])")
BouncingBallsRGB(strip, 3, [[255, 0, 0], [0, 255, 0], [0, 0, 255]])
print("Calling: HalloweenEyes(strip, 255, 0, 0, 1, 4, True, random.randint(5, 50), random.uniform(.01, .2), random.randrange(1, 3))")
HalloweenEyes(strip, 255, 0, 0, 1, 4, True, random.randint(5, 50), random.uniform(.01, .2), random.randrange(1, 3))
print("Calling: MorseCode(strip, 255, 255, 255, 'SOS. This is a test.', .15)")
MorseCode(strip, 255, 255, 255, 'SOS. This is a test.', .15)
print("Calling: Clock1(strip)")
Clock1(strip)
print("Calling: Clock2(strip, True)")
Clock2(strip, True)
print("Calling: FillDownRandom(strip, 0, .1, 1, .2)")
FillDownRandom(strip, 0, .1, 1, .2)
print("Calling: RandomColors(strip, .1)")
RandomColors(strip, .1)
print("========================================")
print("Looping")
print("========================================")
#List of functions:
FadeRGB(strip)
FadeInOut(strip, 255, 255, 255)
Strobe(strip, 255, 255, 255, 5, .5, 3)
Cylon(strip, 255, 0, 0, 3, .1, .5)
Twinkle(strip, 255, 0, 0, 8, .1, False)
TwinkleRandom(strip, 8, .1, False)
Sparkle(strip, 255, 255, 255, 0)
SnowSparkle(strip, 10, 10, 10, .1, random.uniform(0, .5))
RunningLights(strip, 255, 255, 255, .25)
ColorWipe(strip, 255, 0, 0, .02)
ColorWipeReverse(strip, 0, 255, 0, .02)
Rainbow(strip, 0)
RainbowCycle(strip, 5, 0)
ColorChase(strip, 0, 0, 255, .02)
ColorChaseReverse(strip, 0, 255, 0, .02)
TheaterChase(strip, 255, 0, 0, .2, 10)
TheaterChaseRainbow(strip, .1)
MeteorRain(strip, 255, 0, 0, 5, 64, True, .1)
NewKitt(strip, 255, 0, 0, 8, .01, .05)
Fire(strip, Heat, 75, 150, .015)
BouncingBalls(strip, 255, 0, 0, 3)
BouncingBallsRGB(strip, 3, [[255, 0, 0], [0, 255, 0], [0, 0, 255]])
HalloweenEyes(strip, 255, 0, 0, 1, 4, True, random.randint(5, 50), random.uniform(.01, .2), random.randrange(1, 3))
MorseCode(strip, 255, 255, 255, 'SOS. This is a test.', .15)
Clock1(strip)
Clock2(strip, True)
FillDownRandom(strip, 0, .1, 1, .2)
RandomColors(strip, .1)
"""