Skip to content

Commit 9d2b206

Browse files
authored
Add files via upload
change from CustomColorsChase to CustomColorChase
1 parent ef4435c commit 9d2b206

File tree

2 files changed

+63
-5
lines changed

2 files changed

+63
-5
lines changed

examples/led_animation_all_animations.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from adafruit_led_animation.animation.solid import Solid
2222
from adafruit_led_animation.animation.colorcycle import ColorCycle
2323
from adafruit_led_animation.animation.rainbow import Rainbow
24-
from adafruit_led_animation.animation.customcolorschase import CustomColorsChase
24+
from adafruit_led_animation.animation.customcolorchase import CustomColorChase
2525
from adafruit_led_animation.sequence import AnimationSequence
2626
from adafruit_led_animation.color import PURPLE, WHITE, AMBER, JADE, MAGENTA, ORANGE
2727

@@ -44,9 +44,7 @@
4444
rainbow_comet = RainbowComet(pixels, speed=0.1, tail_length=7, bounce=True)
4545
rainbow_chase = RainbowChase(pixels, speed=0.1, size=3, spacing=2, step=8)
4646
rainbow_sparkle = RainbowSparkle(pixels, speed=0.1, num_sparkles=15)
47-
custom_colors_chase = CustomColorsChase(
48-
pixels, speed=0.1, size=2, spacing=3, colors=[ORANGE, WHITE, JADE]
49-
)
47+
custom_color_chase = CustomColorChase(pixels, speed=0.1, size=2, spacing=3,colors=[ORANGE, WHITE, JADE])
5048

5149

5250
animations = AnimationSequence(
@@ -61,7 +59,7 @@
6159
rainbow_comet,
6260
sparkle_pulse,
6361
rainbow_chase,
64-
custom_colors_chase,
62+
custom_color_chase,
6563
advance_interval=5,
6664
auto_clear=True,
6765
)
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
"""
2+
This example displays the basic animations in sequence, at a five second interval.
3+
4+
For NeoPixel FeatherWing. Update pixel_pin and pixel_num to match your wiring if using
5+
a different form of NeoPixels.
6+
7+
This example may not work on SAMD21 (M0) boards.
8+
"""
9+
import board
10+
import neopixel
11+
12+
from adafruit_led_animation.animation.customcolorchase import CustomColorChase
13+
from adafruit_led_animation.sequence import AnimationSequence
14+
# colorwheel only needed for rainbowchase example
15+
from adafruit_led_animation.color import colorwheel
16+
# Colors for customcolorchase examples
17+
from adafruit_led_animation.color import PINK, GREEN, RED, BLUE
18+
19+
# Update to match the pin connected to your NeoPixels
20+
pixel_pin = board.D5
21+
# Update to match the number of NeoPixels you have connected
22+
pixel_num = 30
23+
brightness = 0.3
24+
25+
pixels = neopixel.NeoPixel(
26+
pixel_pin, pixel_num, brightness=brightness, auto_write=False
27+
)
28+
29+
# colors default to RAINBOW as defined in color.py
30+
custom_color_chase_rainbow = CustomColorChase(pixels, speed=0.1, size=2, spacing=3)
31+
custom_color_chase_rainbow_r = CustomColorChase(pixels, speed=0.1, size=3, spacing=3,reverse=True)
32+
33+
# Example with same colors as RainbowChase
34+
steps=30
35+
#This was taken from rainbowchase.py
36+
rainbow_colors = [colorwheel(n % 256) for n in range(0, 512, steps)]
37+
#Now use rainbow_colors with CustomColorChase
38+
custom_color_chase_rainbowchase = CustomColorChase(pixels, speed=0.1, colors=rainbow_colors, size=2, spacing=3)
39+
40+
custom_color_chase_bgp = CustomColorChase(
41+
pixels, speed=0.1, colors=[BLUE, GREEN, PINK], size=3, spacing=2
42+
)
43+
44+
# Can use integer values for color, 0 is black
45+
custom_color_chase_br = CustomColorChase(
46+
pixels, speed=0.1, colors=[BLUE, 0, RED, 0], size=2, spacing=0 )
47+
48+
animations = AnimationSequence(
49+
custom_color_chase_rainbow,
50+
custom_color_chase_rainbow_r,
51+
custom_color_chase_rainbowchase,
52+
custom_color_chase_bgp,
53+
custom_color_chase_br,
54+
advance_interval=6,
55+
#advance_on_cycle_complete=True,
56+
auto_clear=True,
57+
)
58+
59+
while True:
60+
animations.animate()

0 commit comments

Comments
 (0)