-
Notifications
You must be signed in to change notification settings - Fork 0
/
code.py
44 lines (38 loc) · 1.37 KB
/
code.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
41
42
43
44
import board
import neopixel
from adafruit_led_animation.animation.solid import Solid
from adafruit_led_animation.animation.blink import Blink
from adafruit_led_animation.animation.comet import Comet
from adafruit_led_animation.animation.chase import Chase
from adafruit_led_animation.animation.rainbow import Rainbow
from adafruit_led_animation.animation.rainbowchase import RainbowChase
from adafruit_led_animation.sequence import AnimationSequence
from adafruit_led_animation.animation.rainbowcomet import RainbowComet
from adafruit_led_animation.color import RED
from adafruit_led_animation.color import BLUE
# Variables
pixel_controller_pin = board.GP0
pixel_count = 28
pixels = neopixel.NeoPixel(
pixel_controller_pin, pixel_count, auto_write=False, pixel_order=neopixel.RGB
)
pixels.brightness = 0.5
solid = Solid(pixels, color=BLUE)
blink = Blink(pixels, speed=0.5, color=RED)
comet = Comet(pixels, speed=0.01, color=BLUE, tail_length=10, bounce=True)
chase = Chase(pixels, speed=0.1, size=3, spacing=6, color=RED)
rainbow = Rainbow(pixels, speed=0.1, period=2)
rainbow_chase = RainbowChase(pixels, speed=0.1, size=5, spacing=3)
rainbow_comet = RainbowComet(pixels, speed=0.05, bounce=True)
animations = AnimationSequence(
rainbow,
comet,
solid,
rainbow_chase,
blink,
chase,
advance_interval=3,
auto_clear=True,
)
while True:
animations.animate()