Skip to content

Commit fa7bb0f

Browse files
committed
Add AnimationSequence example.
1 parent 5d4e161 commit fa7bb0f

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

examples/led_animation_sequence.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
"""
2+
This example uses AnimationsSequence to display multiple animations in sequence, at a five second
3+
interval.
4+
5+
For NeoPixel FeatherWing. Update pixel_pin and pixel_num to match your wiring if using
6+
a different form of NeoPixels.
7+
8+
This example does not work on SAMD21 (M0) boards.
9+
"""
10+
import board
11+
import neopixel
12+
13+
from adafruit_led_animation.animation.blink import Blink
14+
from adafruit_led_animation.animation.comet import Comet
15+
from adafruit_led_animation.animation.chase import Chase
16+
from adafruit_led_animation.animation.pulse import Pulse
17+
from adafruit_led_animation.sequence import AnimationSequence
18+
from adafruit_led_animation.color import PURPLE, WHITE, AMBER, JADE
19+
20+
# Update to match the pin connected to your NeoPixels
21+
pixel_pin = board.D6
22+
# Update to match the number of NeoPixels you have connected
23+
pixel_num = 32
24+
25+
pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=0.2, auto_write=False)
26+
27+
blink = Blink(pixels, speed=0.5, color=JADE)
28+
comet = Comet(pixels, speed=0.01, color=PURPLE, tail_length=10, bounce=True)
29+
chase = Chase(pixels, speed=0.1, size=3, spacing=6, color=WHITE)
30+
pulse = Pulse(pixels, speed=0.1, period=3, color=AMBER)
31+
32+
33+
animations = AnimationSequence(
34+
comet, blink, chase, pulse, advance_interval=5, auto_clear=True,
35+
)
36+
37+
while True:
38+
animations.animate()

0 commit comments

Comments
 (0)