-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
36 lines (25 loc) · 907 Bytes
/
main.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
import time
import board
import neopixel
LEDS_PER_STRIP = 109
SLEEP_TIME = 0.01
COLORS = [(255, 0, 0), (255, 0, 255), (128, 0, 128)]
BRIGHTNESS = 0.5
def run_color_on_stips(strips: list[neopixel.NeoPixel], color: tuple[int, int, int]):
for strip in strips:
for i in range(LEDS_PER_STRIP):
strip[i] = color
time.sleep(SLEEP_TIME)
def run_colors_on_strips(strips: list[neopixel.NeoPixel], colors: list[tuple[int, int, int]]):
for color in colors:
run_color_on_stips(strips, color)
def main():
pixels1 = neopixel.NeoPixel(board.D18, LEDS_PER_STRIP, brightness=BRIGHTNESS)
pixels2 = neopixel.NeoPixel(board.D21, LEDS_PER_STRIP, brightness=BRIGHTNESS)
pixels1.fill((20, 20, 20))
pixels2.fill((20, 20, 20))
strips = [pixels1, pixels2]
while True:
run_colors_on_strips(strips, COLORS)
if __name__ == '__main__':
main()