diff --git a/examples/led_animation_all_animations.py b/examples/led_animation_all_animations.py index 16a82bd..0d55804 100644 --- a/examples/led_animation_all_animations.py +++ b/examples/led_animation_all_animations.py @@ -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.colorcycle import ColorCycle 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.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_chase = RainbowChase(pixels, speed=0.1, size=3, spacing=2, step=8) 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( @@ -57,6 +59,7 @@ animations = AnimationSequence( rainbow_comet, sparkle_pulse, rainbow_chase, + custom_color_chase, advance_interval=5, auto_clear=True, ) diff --git a/examples/led_animation_customcolorchase.py b/examples/led_animation_customcolorchase.py new file mode 100644 index 0000000..c7e149d --- /dev/null +++ b/examples/led_animation_customcolorchase.py @@ -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()