Add files via upload
Added CustomColorChase example. Updated All example with new CustomColorChase
This commit is contained in:
parent
33a95d63dc
commit
ca806b8207
2 changed files with 58 additions and 0 deletions
|
|
@ -21,6 +21,7 @@ from adafruit_led_animation.animation.rainbowcomet import RainbowComet
|
||||||
from adafruit_led_animation.animation.solid import Solid
|
from adafruit_led_animation.animation.solid import Solid
|
||||||
from adafruit_led_animation.animation.colorcycle import ColorCycle
|
from adafruit_led_animation.animation.colorcycle import ColorCycle
|
||||||
from adafruit_led_animation.animation.rainbow import Rainbow
|
from adafruit_led_animation.animation.rainbow import Rainbow
|
||||||
|
from adafruit_led_animation.animation.customcolorchase import CustomColorChase
|
||||||
from adafruit_led_animation.sequence import AnimationSequence
|
from adafruit_led_animation.sequence import AnimationSequence
|
||||||
from adafruit_led_animation.color import PURPLE, WHITE, AMBER, JADE, MAGENTA, ORANGE
|
from adafruit_led_animation.color import PURPLE, WHITE, AMBER, JADE, MAGENTA, ORANGE
|
||||||
|
|
||||||
|
|
@ -43,6 +44,7 @@ sparkle_pulse = SparklePulse(pixels, speed=0.1, period=3, color=JADE)
|
||||||
rainbow_comet = RainbowComet(pixels, speed=0.1, tail_length=7, bounce=True)
|
rainbow_comet = RainbowComet(pixels, speed=0.1, tail_length=7, bounce=True)
|
||||||
rainbow_chase = RainbowChase(pixels, speed=0.1, size=3, spacing=2, step=8)
|
rainbow_chase = RainbowChase(pixels, speed=0.1, size=3, spacing=2, step=8)
|
||||||
rainbow_sparkle = RainbowSparkle(pixels, speed=0.1, num_sparkles=15)
|
rainbow_sparkle = RainbowSparkle(pixels, speed=0.1, num_sparkles=15)
|
||||||
|
custom_color_chase = CustomColorChase(pixels, speed=0.1, size=2, spacing=3,colors=[ORANGE, WHITE, JADE])
|
||||||
|
|
||||||
|
|
||||||
animations = AnimationSequence(
|
animations = AnimationSequence(
|
||||||
|
|
@ -57,6 +59,7 @@ animations = AnimationSequence(
|
||||||
rainbow_comet,
|
rainbow_comet,
|
||||||
sparkle_pulse,
|
sparkle_pulse,
|
||||||
rainbow_chase,
|
rainbow_chase,
|
||||||
|
custom_color_chase,
|
||||||
advance_interval=5,
|
advance_interval=5,
|
||||||
auto_clear=True,
|
auto_clear=True,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
55
examples/led_animation_customcolorchase.py
Normal file
55
examples/led_animation_customcolorchase.py
Normal file
|
|
@ -0,0 +1,55 @@
|
||||||
|
"""
|
||||||
|
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.customcolorchase import CustomColorChase
|
||||||
|
from adafruit_led_animation.sequence import AnimationSequence
|
||||||
|
from adafruit_led_animation.color import (
|
||||||
|
PINK,
|
||||||
|
PURPLE,
|
||||||
|
GREEN,
|
||||||
|
RED,
|
||||||
|
WHITE,
|
||||||
|
BLUE
|
||||||
|
)
|
||||||
|
|
||||||
|
# Update to match the pin connected to your NeoPixels
|
||||||
|
pixel_pin = board.D5
|
||||||
|
# Update to match the number of NeoPixels you have connected
|
||||||
|
pixel_num = 32
|
||||||
|
brightness = 0.3
|
||||||
|
|
||||||
|
pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=brightness, auto_write=False)
|
||||||
|
|
||||||
|
# colors default to RAINBOW
|
||||||
|
custom_color_chase_rainbow = CustomColorChase(pixels, speed=0.1, size=2, spacing=3)
|
||||||
|
# Patriotic
|
||||||
|
custom_color_chase_rwb = CustomColorChase(pixels, speed=0.1, colors=[RED, WHITE, BLUE], size=2, spacing=3)
|
||||||
|
# St Pat Day
|
||||||
|
custom_color_chase_gw = CustomColorChase(pixels, speed=0.1, colors=[GREEN, WHITE], size=2, spacing=3)
|
||||||
|
# Christmas
|
||||||
|
custom_color_chase_rg = CustomColorChase(pixels, speed=0.1, colors=[RED, GREEN], size=2, spacing=3)
|
||||||
|
custom_color_chase_rg_r = CustomColorChase(pixels, speed=0.1, colors=[RED, GREEN], size=2, spacing=3, reverse=True)
|
||||||
|
# Valentines Day
|
||||||
|
custom_color_chase_rp = CustomColorChase(pixels, speed=0.1, colors=[RED , PINK], size=2, spacing=3)
|
||||||
|
|
||||||
|
|
||||||
|
animations = AnimationSequence(
|
||||||
|
custom_color_chase_rainbow,
|
||||||
|
custom_color_chase_rp,
|
||||||
|
custom_color_chase_gw,
|
||||||
|
custom_color_chase_rwb,
|
||||||
|
custom_color_chase_rg,
|
||||||
|
custom_color_chase_rg_r,
|
||||||
|
advance_interval=6, auto_clear=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
while True:
|
||||||
|
animations.animate()
|
||||||
Loading…
Reference in a new issue