50 lines
1.6 KiB
Python
50 lines
1.6 KiB
Python
"""
|
|
This example displays the basic animations in sequence, at a five second interval.
|
|
|
|
For NeoPixel FeatherWing. Update pixel_pin and pixel_num to match your wiring if using
|
|
a different form of NeoPixels.
|
|
|
|
This example may not work on SAMD21 (M0) boards.
|
|
"""
|
|
import board
|
|
import neopixel
|
|
|
|
from adafruit_led_animation.animation.solid import Solid
|
|
from adafruit_led_animation.animation.colorcycle import ColorCycle
|
|
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.pulse import Pulse
|
|
from adafruit_led_animation.sequence import AnimationSequence
|
|
from adafruit_led_animation.color import (
|
|
PURPLE,
|
|
WHITE,
|
|
AMBER,
|
|
JADE,
|
|
TEAL,
|
|
PINK,
|
|
MAGENTA,
|
|
ORANGE,
|
|
)
|
|
|
|
# Update to match the pin connected to your NeoPixels
|
|
pixel_pin = board.D6
|
|
# Update to match the number of NeoPixels you have connected
|
|
pixel_num = 32
|
|
|
|
pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=0.5, auto_write=False)
|
|
|
|
solid = Solid(pixels, color=PINK)
|
|
blink = Blink(pixels, speed=0.5, color=JADE)
|
|
colorcycle = ColorCycle(pixels, speed=0.4, colors=[MAGENTA, ORANGE, TEAL])
|
|
chase = Chase(pixels, speed=0.1, color=WHITE, size=3, spacing=6)
|
|
comet = Comet(pixels, speed=0.01, color=PURPLE, tail_length=10, bounce=True)
|
|
pulse = Pulse(pixels, speed=0.1, color=AMBER, period=3)
|
|
|
|
|
|
animations = AnimationSequence(
|
|
solid, blink, colorcycle, chase, comet, pulse, advance_interval=5, auto_clear=True,
|
|
)
|
|
|
|
while True:
|
|
animations.animate()
|