From 33a95d63dc6bfc160cddb171d013acdc4b24730d Mon Sep 17 00:00:00 2001 From: cjsieh Date: Sun, 14 Jun 2020 18:50:43 -0500 Subject: [PATCH 01/20] Add files via upload Add ability to select custom colors for chase animation --- .../animation/customcolorchase.py | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 adafruit_led_animation/animation/customcolorchase.py diff --git a/adafruit_led_animation/animation/customcolorchase.py b/adafruit_led_animation/animation/customcolorchase.py new file mode 100644 index 0000000..52d43ba --- /dev/null +++ b/adafruit_led_animation/animation/customcolorchase.py @@ -0,0 +1,77 @@ +# The MIT License (MIT) +# +# Copyright (c) 2019-2020 Roy Hooper +# Copyright (c) 2020 Kattni Rembor for Adafruit Industries +# Copyright (c) 2020 Connie Sieh +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +""" +`adafruit_led_animation.animation.rainbowchase` +================================================================================ + +Rainbow chase animation for CircuitPython helper library for LED animations. + +* Author(s): Roy Hooper, Kattni Rembor, Connie Sieh + +Implementation Notes +-------------------- + +**Hardware:** + +* `Adafruit NeoPixels `_ +* `Adafruit DotStars `_ + +**Software and Dependencies:** + +* Adafruit CircuitPython firmware for the supported boards: + https://circuitpython.org/downloads + + +""" + +from adafruit_led_animation.animation.chase import Chase +from adafruit_led_animation.color import RAINBOW + + +class CustomColorChase(Chase): + """ + Chase pixels in one direction, like a theater marquee but with Custom Color! + + :param pixel_object: The initialised LED object. + :param float speed: Animation speed rate in seconds, e.g. ``0.1``. + :param colors: Animation color in list of `(r, g, b)`` tuple, or ``0x000000`` hex format. + :param size: Number of pixels to turn on in a row. + :param spacing: Number of pixels to turn off in a row. + :param reverse: Reverse direction of movement. + """ + + # pylint: disable=too-many-arguments + def __init__( + self, pixel_object, speed, size=2, spacing=3, reverse=False, name=None, colors=RAINBOW): + self._num_colors = len(colors) + self._colors = colors + self._color_idx = 0 + super().__init__(pixel_object, speed, 0, size, spacing, reverse, name) + + def bar_color(self, n, pixel_no=0): + return self._colors[self._color_idx - (n % len(self._colors))] + + def on_cycle_complete(self): + self._color_idx = (self._color_idx + self._direction) % len(self._colors) + super().on_cycle_complete() From ca806b8207e308b3766f377c684ffdcbf9242c63 Mon Sep 17 00:00:00 2001 From: cjsieh Date: Sun, 14 Jun 2020 18:52:32 -0500 Subject: [PATCH 02/20] Add files via upload Added CustomColorChase example. Updated All example with new CustomColorChase --- examples/led_animation_all_animations.py | 3 ++ examples/led_animation_customcolorchase.py | 55 ++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 examples/led_animation_customcolorchase.py 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.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 @@ 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 @@ 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() From a6ff8746cc739b860fe28382dd51f9a5acdd430b Mon Sep 17 00:00:00 2001 From: cjsieh Date: Mon, 15 Jun 2020 11:24:06 -0500 Subject: [PATCH 03/20] Add files via upload Changed from customcolorchase to customcolorschase --- examples/led_animation_customcolorschase.py | 55 +++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 examples/led_animation_customcolorschase.py diff --git a/examples/led_animation_customcolorschase.py b/examples/led_animation_customcolorschase.py new file mode 100644 index 0000000..6d65488 --- /dev/null +++ b/examples/led_animation_customcolorschase.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.customcolorschase import CustomColorsChase +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_colors_chase_rainbow = CustomColorsChase(pixels, speed=0.1, size=2, spacing=3) +# Patriotic +custom_colors_chase_rwb = CustomColorsChase(pixels, speed=0.1, colors=[RED, WHITE, BLUE], size=2, spacing=3) +# St Pat Day +custom_colors_chase_gw = CustomColorsChase(pixels, speed=0.1, colors=[GREEN, WHITE], size=2, spacing=3) +# Christmas +custom_colors_chase_rg = CustomColorsChase(pixels, speed=0.1, colors=[RED, GREEN], size=2, spacing=3) +custom_colors_chase_rg_r = CustomColorsChase(pixels, speed=0.1, colors=[RED, GREEN], size=1, spacing=2, reverse=True) +# Valentines Day +custom_colors_chase_rp = CustomColorsChase(pixels, speed=0.1, colors=[RED , PINK], size=2, spacing=3) + + +animations = AnimationSequence( + custom_colors_chase_rainbow, + custom_colors_chase_rp, + custom_colors_chase_gw, + custom_colors_chase_rwb, + custom_colors_chase_rg, + custom_colors_chase_rg_r, + advance_interval=6, auto_clear=True, +) + +while True: + animations.animate() From 9d416515034ab05eee28d0220c5c7a091b1495f6 Mon Sep 17 00:00:00 2001 From: cjsieh Date: Mon, 15 Jun 2020 11:25:30 -0500 Subject: [PATCH 04/20] Delete led_animation_customcolorchase.py Changed from customcolorchase to customcolorschase --- examples/led_animation_customcolorchase.py | 55 ---------------------- 1 file changed, 55 deletions(-) delete mode 100644 examples/led_animation_customcolorchase.py diff --git a/examples/led_animation_customcolorchase.py b/examples/led_animation_customcolorchase.py deleted file mode 100644 index c7e149d..0000000 --- a/examples/led_animation_customcolorchase.py +++ /dev/null @@ -1,55 +0,0 @@ -""" -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() From 4e7ffc12cc825d45102f420fe930f8c666ee1d5d Mon Sep 17 00:00:00 2001 From: cjsieh Date: Mon, 15 Jun 2020 11:26:34 -0500 Subject: [PATCH 05/20] Add files via upload Changed example CustomColorChase to CustomColorsChase --- examples/led_animation_all_animations.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/led_animation_all_animations.py b/examples/led_animation_all_animations.py index 0d55804..4518113 100644 --- a/examples/led_animation_all_animations.py +++ b/examples/led_animation_all_animations.py @@ -21,7 +21,7 @@ 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.animation.customcolorschase import CustomColorsChase from adafruit_led_animation.sequence import AnimationSequence from adafruit_led_animation.color import PURPLE, WHITE, AMBER, JADE, MAGENTA, ORANGE @@ -44,7 +44,7 @@ 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]) +custom_colors_chase = CustomColorsChase(pixels, speed=0.1, size=2, spacing=3,colors=[ORANGE, WHITE, JADE]) animations = AnimationSequence( @@ -59,7 +59,7 @@ rainbow_comet, sparkle_pulse, rainbow_chase, - custom_color_chase, + custom_colors_chase, advance_interval=5, auto_clear=True, ) From 85edc47550cb57b1c19778e42830e67f2712bf59 Mon Sep 17 00:00:00 2001 From: cjsieh Date: Mon, 15 Jun 2020 11:28:24 -0500 Subject: [PATCH 06/20] Add files via upload Change from CustomColorChase to CustomColorsChase --- .../animation/customcolorschase.py | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 adafruit_led_animation/animation/customcolorschase.py diff --git a/adafruit_led_animation/animation/customcolorschase.py b/adafruit_led_animation/animation/customcolorschase.py new file mode 100644 index 0000000..f1cc02c --- /dev/null +++ b/adafruit_led_animation/animation/customcolorschase.py @@ -0,0 +1,77 @@ +# The MIT License (MIT) +# +# Copyright (c) 2019-2020 Roy Hooper +# Copyright (c) 2020 Kattni Rembor for Adafruit Industries +# Copyright (c) 2020 Connie Sieh +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +""" +`adafruit_led_animation.animation.rainbowchase` +================================================================================ + +Rainbow chase animation for CircuitPython helper library for LED animations. + +* Author(s): Roy Hooper, Kattni Rembor, Connie Sieh + +Implementation Notes +-------------------- + +**Hardware:** + +* `Adafruit NeoPixels `_ +* `Adafruit DotStars `_ + +**Software and Dependencies:** + +* Adafruit CircuitPython firmware for the supported boards: + https://circuitpython.org/downloads + + +""" + +from adafruit_led_animation.animation.chase import Chase +from adafruit_led_animation.color import RAINBOW + + +class CustomColorsChase(Chase): + """ + Chase pixels in one direction, like a theater marquee with Custom Colors + + :param pixel_object: The initialised LED object. + :param float speed: Animation speed rate in seconds, e.g. ``0.1``. + :param colors: Animation color in list of `(r, g, b)`` tuple, or ``0x000000`` hex format, default is RAINBOW. + :param size: Number of pixels to turn on in a row. + :param spacing: Number of pixels to turn off in a row. + :param reverse: Reverse direction of movement. + """ + + # pylint: disable=too-many-arguments + def __init__( + self, pixel_object, speed, size=2, spacing=3, reverse=False, name=None, colors=RAINBOW): + self._num_colors = len(colors) + self._colors = colors + self._color_idx = 0 + super().__init__(pixel_object, speed, 0, size, spacing, reverse, name) + + def bar_color(self, n, pixel_no=0): + return self._colors[self._color_idx - (n % len(self._colors))] + + def on_cycle_complete(self): + self._color_idx = (self._color_idx + self._direction) % len(self._colors) + super().on_cycle_complete() From e62e5177e0235591aca02c72adde2ecc5ccb0ab7 Mon Sep 17 00:00:00 2001 From: cjsieh Date: Mon, 15 Jun 2020 11:29:05 -0500 Subject: [PATCH 07/20] Delete customcolorchase.py changed from customcolorchase to customcolorschase --- .../animation/customcolorchase.py | 77 ------------------- 1 file changed, 77 deletions(-) delete mode 100644 adafruit_led_animation/animation/customcolorchase.py diff --git a/adafruit_led_animation/animation/customcolorchase.py b/adafruit_led_animation/animation/customcolorchase.py deleted file mode 100644 index 52d43ba..0000000 --- a/adafruit_led_animation/animation/customcolorchase.py +++ /dev/null @@ -1,77 +0,0 @@ -# The MIT License (MIT) -# -# Copyright (c) 2019-2020 Roy Hooper -# Copyright (c) 2020 Kattni Rembor for Adafruit Industries -# Copyright (c) 2020 Connie Sieh -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -""" -`adafruit_led_animation.animation.rainbowchase` -================================================================================ - -Rainbow chase animation for CircuitPython helper library for LED animations. - -* Author(s): Roy Hooper, Kattni Rembor, Connie Sieh - -Implementation Notes --------------------- - -**Hardware:** - -* `Adafruit NeoPixels `_ -* `Adafruit DotStars `_ - -**Software and Dependencies:** - -* Adafruit CircuitPython firmware for the supported boards: - https://circuitpython.org/downloads - - -""" - -from adafruit_led_animation.animation.chase import Chase -from adafruit_led_animation.color import RAINBOW - - -class CustomColorChase(Chase): - """ - Chase pixels in one direction, like a theater marquee but with Custom Color! - - :param pixel_object: The initialised LED object. - :param float speed: Animation speed rate in seconds, e.g. ``0.1``. - :param colors: Animation color in list of `(r, g, b)`` tuple, or ``0x000000`` hex format. - :param size: Number of pixels to turn on in a row. - :param spacing: Number of pixels to turn off in a row. - :param reverse: Reverse direction of movement. - """ - - # pylint: disable=too-many-arguments - def __init__( - self, pixel_object, speed, size=2, spacing=3, reverse=False, name=None, colors=RAINBOW): - self._num_colors = len(colors) - self._colors = colors - self._color_idx = 0 - super().__init__(pixel_object, speed, 0, size, spacing, reverse, name) - - def bar_color(self, n, pixel_no=0): - return self._colors[self._color_idx - (n % len(self._colors))] - - def on_cycle_complete(self): - self._color_idx = (self._color_idx + self._direction) % len(self._colors) - super().on_cycle_complete() From b068b7c80d52ae6d9ef6af0adca52e0b0e95e83c Mon Sep 17 00:00:00 2001 From: cjsieh Date: Mon, 15 Jun 2020 11:58:22 -0500 Subject: [PATCH 08/20] Add files via upload fixed spaces before/after parameters --- examples/led_animation_all_animations.py | 2 +- examples/led_animation_customcolorschase.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/led_animation_all_animations.py b/examples/led_animation_all_animations.py index 4518113..e322082 100644 --- a/examples/led_animation_all_animations.py +++ b/examples/led_animation_all_animations.py @@ -44,7 +44,7 @@ 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_colors_chase = CustomColorsChase(pixels, speed=0.1, size=2, spacing=3,colors=[ORANGE, WHITE, JADE]) +custom_colors_chase = CustomColorsChase(pixels, speed=0.1, size=2, spacing=3, colors=[ORANGE, WHITE, JADE]) animations = AnimationSequence( diff --git a/examples/led_animation_customcolorschase.py b/examples/led_animation_customcolorschase.py index 6d65488..eb11c16 100644 --- a/examples/led_animation_customcolorschase.py +++ b/examples/led_animation_customcolorschase.py @@ -38,7 +38,7 @@ custom_colors_chase_rg = CustomColorsChase(pixels, speed=0.1, colors=[RED, GREEN], size=2, spacing=3) custom_colors_chase_rg_r = CustomColorsChase(pixels, speed=0.1, colors=[RED, GREEN], size=1, spacing=2, reverse=True) # Valentines Day -custom_colors_chase_rp = CustomColorsChase(pixels, speed=0.1, colors=[RED , PINK], size=2, spacing=3) +custom_colors_chase_rp = CustomColorsChase(pixels, speed=0.1, colors=[RED, PINK], size=2, spacing=3) animations = AnimationSequence( From 5892c2550b8ff54d75522cfe3a142afe813f6177 Mon Sep 17 00:00:00 2001 From: cjsieh Date: Mon, 15 Jun 2020 13:37:03 -0500 Subject: [PATCH 09/20] Add files via upload reformatted via black --- examples/led_animation_all_animations.py | 4 ++- examples/led_animation_customcolorschase.py | 36 ++++++++++++--------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/examples/led_animation_all_animations.py b/examples/led_animation_all_animations.py index e322082..3b7a20e 100644 --- a/examples/led_animation_all_animations.py +++ b/examples/led_animation_all_animations.py @@ -44,7 +44,9 @@ 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_colors_chase = CustomColorsChase(pixels, speed=0.1, size=2, spacing=3, colors=[ORANGE, WHITE, JADE]) +custom_colors_chase = CustomColorsChase( + pixels, speed=0.1, size=2, spacing=3, colors=[ORANGE, WHITE, JADE] +) animations = AnimationSequence( diff --git a/examples/led_animation_customcolorschase.py b/examples/led_animation_customcolorschase.py index eb11c16..76aa7e2 100644 --- a/examples/led_animation_customcolorschase.py +++ b/examples/led_animation_customcolorschase.py @@ -11,14 +11,7 @@ from adafruit_led_animation.animation.customcolorschase import CustomColorsChase from adafruit_led_animation.sequence import AnimationSequence -from adafruit_led_animation.color import ( - PINK, - PURPLE, - GREEN, - RED, - WHITE, - BLUE -) +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 @@ -26,19 +19,31 @@ pixel_num = 32 brightness = 0.3 -pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=brightness, auto_write=False) +pixels = neopixel.NeoPixel( + pixel_pin, pixel_num, brightness=brightness, auto_write=False +) # colors default to RAINBOW custom_colors_chase_rainbow = CustomColorsChase(pixels, speed=0.1, size=2, spacing=3) # Patriotic -custom_colors_chase_rwb = CustomColorsChase(pixels, speed=0.1, colors=[RED, WHITE, BLUE], size=2, spacing=3) +custom_colors_chase_rwb = CustomColorsChase( + pixels, speed=0.1, colors=[RED, WHITE, BLUE], size=2, spacing=3 +) # St Pat Day -custom_colors_chase_gw = CustomColorsChase(pixels, speed=0.1, colors=[GREEN, WHITE], size=2, spacing=3) +custom_colors_chase_gw = CustomColorsChase( + pixels, speed=0.1, colors=[GREEN, WHITE], size=2, spacing=3 +) # Christmas -custom_colors_chase_rg = CustomColorsChase(pixels, speed=0.1, colors=[RED, GREEN], size=2, spacing=3) -custom_colors_chase_rg_r = CustomColorsChase(pixels, speed=0.1, colors=[RED, GREEN], size=1, spacing=2, reverse=True) +custom_colors_chase_rg = CustomColorsChase( + pixels, speed=0.1, colors=[RED, GREEN], size=2, spacing=3 +) +custom_colors_chase_rg_r = CustomColorsChase( + pixels, speed=0.1, colors=[RED, GREEN], size=1, spacing=2, reverse=True +) # Valentines Day -custom_colors_chase_rp = CustomColorsChase(pixels, speed=0.1, colors=[RED, PINK], size=2, spacing=3) +custom_colors_chase_rp = CustomColorsChase( + pixels, speed=0.1, colors=[RED, PINK], size=2, spacing=3 +) animations = AnimationSequence( @@ -48,7 +53,8 @@ custom_colors_chase_rwb, custom_colors_chase_rg, custom_colors_chase_rg_r, - advance_interval=6, auto_clear=True, + advance_interval=6, + auto_clear=True, ) while True: From 3a224b09f974bec08c7a04bfcfd2e49ee81ee399 Mon Sep 17 00:00:00 2001 From: cjsieh Date: Mon, 15 Jun 2020 13:37:50 -0500 Subject: [PATCH 10/20] Add files via upload reformatted via black --- adafruit_led_animation/animation/customcolorschase.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/adafruit_led_animation/animation/customcolorschase.py b/adafruit_led_animation/animation/customcolorschase.py index f1cc02c..3645344 100644 --- a/adafruit_led_animation/animation/customcolorschase.py +++ b/adafruit_led_animation/animation/customcolorschase.py @@ -63,7 +63,15 @@ class CustomColorsChase(Chase): # pylint: disable=too-many-arguments def __init__( - self, pixel_object, speed, size=2, spacing=3, reverse=False, name=None, colors=RAINBOW): + self, + pixel_object, + speed, + size=2, + spacing=3, + reverse=False, + name=None, + colors=RAINBOW, + ): self._num_colors = len(colors) self._colors = colors self._color_idx = 0 From 05c690803f87422feaff5b328677256e00e0041f Mon Sep 17 00:00:00 2001 From: cjsieh Date: Mon, 15 Jun 2020 13:47:55 -0500 Subject: [PATCH 11/20] Add files via upload fixed "line too long" as indicated by pylint --- adafruit_led_animation/animation/customcolorschase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit_led_animation/animation/customcolorschase.py b/adafruit_led_animation/animation/customcolorschase.py index 3645344..02f66e3 100644 --- a/adafruit_led_animation/animation/customcolorschase.py +++ b/adafruit_led_animation/animation/customcolorschase.py @@ -55,7 +55,7 @@ class CustomColorsChase(Chase): :param pixel_object: The initialised LED object. :param float speed: Animation speed rate in seconds, e.g. ``0.1``. - :param colors: Animation color in list of `(r, g, b)`` tuple, or ``0x000000`` hex format, default is RAINBOW. + :param colors: Animation colors in list of `(r, g, b)`` tuple, or ``0x000000`` hex format :param size: Number of pixels to turn on in a row. :param spacing: Number of pixels to turn off in a row. :param reverse: Reverse direction of movement. From 4d8971d38303767d0d3b219d53b722cd2128ece7 Mon Sep 17 00:00:00 2001 From: Kattni Rembor Date: Fri, 19 Jun 2020 16:06:13 -0400 Subject: [PATCH 12/20] Add sequence fix. --- adafruit_led_animation/sequence.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adafruit_led_animation/sequence.py b/adafruit_led_animation/sequence.py index f1aba9c..31aac05 100644 --- a/adafruit_led_animation/sequence.py +++ b/adafruit_led_animation/sequence.py @@ -317,6 +317,6 @@ def on_cycle_complete(self): super().on_cycle_complete() self._running = False - def animate(self): - super().animate() + def animate(self, show=True): + super().animate(show) return self._running From c88584d4bb675ffc6253dc7e701ba4f230b4d333 Mon Sep 17 00:00:00 2001 From: cjsieh Date: Fri, 19 Jun 2020 21:22:52 -0500 Subject: [PATCH 13/20] Add files via upload remove references to rainbowchase. Change customcolorschase to customcolorchase. --- customcolorchase.py | 85 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 customcolorchase.py diff --git a/customcolorchase.py b/customcolorchase.py new file mode 100644 index 0000000..7defcb6 --- /dev/null +++ b/customcolorchase.py @@ -0,0 +1,85 @@ +# The MIT License (MIT) +# +# Copyright (c) 2019-2020 Roy Hooper +# Copyright (c) 2020 Kattni Rembor for Adafruit Industries +# Copyright (c) 2020 Connie Sieh +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +""" +`adafruit_led_animation.animation.customcolorchase` +================================================================================ + +Custom color chase animation for CircuitPython helper library for LED animations. + +* Author(s): Roy Hooper, Kattni Rembor, Connie Sieh + +Implementation Notes +-------------------- + +**Hardware:** + +* `Adafruit NeoPixels `_ +* `Adafruit DotStars `_ + +**Software and Dependencies:** + +* Adafruit CircuitPython firmware for the supported boards: + https://circuitpython.org/downloads + + +""" + +from adafruit_led_animation.animation.chase import Chase +from adafruit_led_animation.color import RAINBOW + + +class CustomColorChase(Chase): + """ + Chase pixels in one direction, like a theater marquee with Custom Colors + + :param pixel_object: The initialised LED object. + :param float speed: Animation speed rate in seconds, e.g. ``0.1``. + :param colors: Animation colors in list of `(r, g, b)`` tuple, or ``0x000000`` hex format + :param size: Number of pixels to turn on in a row. + :param spacing: Number of pixels to turn off in a row. + :param reverse: Reverse direction of movement. + """ + + # pylint: disable=too-many-arguments + def __init__( + self, + pixel_object, + speed, + size=2, + spacing=3, + reverse=False, + name=None, + colors=RAINBOW, + ): + self._num_colors = len(colors) + self._colors = colors + self._color_idx = 0 + super().__init__(pixel_object, speed, 0, size, spacing, reverse, name) + + def bar_color(self, n, pixel_no=0): + return self._colors[self._color_idx - (n % len(self._colors))] + + def on_cycle_complete(self): + self._color_idx = (self._color_idx + self._direction) % len(self._colors) + super().on_cycle_complete() From 5554e360c21ef29623f551f51305eacc9b6ef9ee Mon Sep 17 00:00:00 2001 From: cjsieh Date: Fri, 19 Jun 2020 21:23:34 -0500 Subject: [PATCH 14/20] Delete customcolorchase.py put in wrong place --- customcolorchase.py | 85 --------------------------------------------- 1 file changed, 85 deletions(-) delete mode 100644 customcolorchase.py diff --git a/customcolorchase.py b/customcolorchase.py deleted file mode 100644 index 7defcb6..0000000 --- a/customcolorchase.py +++ /dev/null @@ -1,85 +0,0 @@ -# The MIT License (MIT) -# -# Copyright (c) 2019-2020 Roy Hooper -# Copyright (c) 2020 Kattni Rembor for Adafruit Industries -# Copyright (c) 2020 Connie Sieh -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -""" -`adafruit_led_animation.animation.customcolorchase` -================================================================================ - -Custom color chase animation for CircuitPython helper library for LED animations. - -* Author(s): Roy Hooper, Kattni Rembor, Connie Sieh - -Implementation Notes --------------------- - -**Hardware:** - -* `Adafruit NeoPixels `_ -* `Adafruit DotStars `_ - -**Software and Dependencies:** - -* Adafruit CircuitPython firmware for the supported boards: - https://circuitpython.org/downloads - - -""" - -from adafruit_led_animation.animation.chase import Chase -from adafruit_led_animation.color import RAINBOW - - -class CustomColorChase(Chase): - """ - Chase pixels in one direction, like a theater marquee with Custom Colors - - :param pixel_object: The initialised LED object. - :param float speed: Animation speed rate in seconds, e.g. ``0.1``. - :param colors: Animation colors in list of `(r, g, b)`` tuple, or ``0x000000`` hex format - :param size: Number of pixels to turn on in a row. - :param spacing: Number of pixels to turn off in a row. - :param reverse: Reverse direction of movement. - """ - - # pylint: disable=too-many-arguments - def __init__( - self, - pixel_object, - speed, - size=2, - spacing=3, - reverse=False, - name=None, - colors=RAINBOW, - ): - self._num_colors = len(colors) - self._colors = colors - self._color_idx = 0 - super().__init__(pixel_object, speed, 0, size, spacing, reverse, name) - - def bar_color(self, n, pixel_no=0): - return self._colors[self._color_idx - (n % len(self._colors))] - - def on_cycle_complete(self): - self._color_idx = (self._color_idx + self._direction) % len(self._colors) - super().on_cycle_complete() From 201bb4781a8a1ae3e20cc484584c5cadc15bd5fe Mon Sep 17 00:00:00 2001 From: cjsieh Date: Fri, 19 Jun 2020 21:24:34 -0500 Subject: [PATCH 15/20] Add files via upload Changed references to rainbowchase. Changed from CustomColorsChase to CustomColorChase --- .../animation/customcolorchase.py | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 adafruit_led_animation/animation/customcolorchase.py diff --git a/adafruit_led_animation/animation/customcolorchase.py b/adafruit_led_animation/animation/customcolorchase.py new file mode 100644 index 0000000..7defcb6 --- /dev/null +++ b/adafruit_led_animation/animation/customcolorchase.py @@ -0,0 +1,85 @@ +# The MIT License (MIT) +# +# Copyright (c) 2019-2020 Roy Hooper +# Copyright (c) 2020 Kattni Rembor for Adafruit Industries +# Copyright (c) 2020 Connie Sieh +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +""" +`adafruit_led_animation.animation.customcolorchase` +================================================================================ + +Custom color chase animation for CircuitPython helper library for LED animations. + +* Author(s): Roy Hooper, Kattni Rembor, Connie Sieh + +Implementation Notes +-------------------- + +**Hardware:** + +* `Adafruit NeoPixels `_ +* `Adafruit DotStars `_ + +**Software and Dependencies:** + +* Adafruit CircuitPython firmware for the supported boards: + https://circuitpython.org/downloads + + +""" + +from adafruit_led_animation.animation.chase import Chase +from adafruit_led_animation.color import RAINBOW + + +class CustomColorChase(Chase): + """ + Chase pixels in one direction, like a theater marquee with Custom Colors + + :param pixel_object: The initialised LED object. + :param float speed: Animation speed rate in seconds, e.g. ``0.1``. + :param colors: Animation colors in list of `(r, g, b)`` tuple, or ``0x000000`` hex format + :param size: Number of pixels to turn on in a row. + :param spacing: Number of pixels to turn off in a row. + :param reverse: Reverse direction of movement. + """ + + # pylint: disable=too-many-arguments + def __init__( + self, + pixel_object, + speed, + size=2, + spacing=3, + reverse=False, + name=None, + colors=RAINBOW, + ): + self._num_colors = len(colors) + self._colors = colors + self._color_idx = 0 + super().__init__(pixel_object, speed, 0, size, spacing, reverse, name) + + def bar_color(self, n, pixel_no=0): + return self._colors[self._color_idx - (n % len(self._colors))] + + def on_cycle_complete(self): + self._color_idx = (self._color_idx + self._direction) % len(self._colors) + super().on_cycle_complete() From ef4435c4bf8b4aeb7882e4d3ba357adc5847f7b6 Mon Sep 17 00:00:00 2001 From: cjsieh Date: Fri, 19 Jun 2020 21:26:18 -0500 Subject: [PATCH 16/20] Delete customcolorschase.py changed from customcolorschase to customcolorchase --- .../animation/customcolorschase.py | 85 ------------------- 1 file changed, 85 deletions(-) delete mode 100644 adafruit_led_animation/animation/customcolorschase.py diff --git a/adafruit_led_animation/animation/customcolorschase.py b/adafruit_led_animation/animation/customcolorschase.py deleted file mode 100644 index 02f66e3..0000000 --- a/adafruit_led_animation/animation/customcolorschase.py +++ /dev/null @@ -1,85 +0,0 @@ -# The MIT License (MIT) -# -# Copyright (c) 2019-2020 Roy Hooper -# Copyright (c) 2020 Kattni Rembor for Adafruit Industries -# Copyright (c) 2020 Connie Sieh -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -""" -`adafruit_led_animation.animation.rainbowchase` -================================================================================ - -Rainbow chase animation for CircuitPython helper library for LED animations. - -* Author(s): Roy Hooper, Kattni Rembor, Connie Sieh - -Implementation Notes --------------------- - -**Hardware:** - -* `Adafruit NeoPixels `_ -* `Adafruit DotStars `_ - -**Software and Dependencies:** - -* Adafruit CircuitPython firmware for the supported boards: - https://circuitpython.org/downloads - - -""" - -from adafruit_led_animation.animation.chase import Chase -from adafruit_led_animation.color import RAINBOW - - -class CustomColorsChase(Chase): - """ - Chase pixels in one direction, like a theater marquee with Custom Colors - - :param pixel_object: The initialised LED object. - :param float speed: Animation speed rate in seconds, e.g. ``0.1``. - :param colors: Animation colors in list of `(r, g, b)`` tuple, or ``0x000000`` hex format - :param size: Number of pixels to turn on in a row. - :param spacing: Number of pixels to turn off in a row. - :param reverse: Reverse direction of movement. - """ - - # pylint: disable=too-many-arguments - def __init__( - self, - pixel_object, - speed, - size=2, - spacing=3, - reverse=False, - name=None, - colors=RAINBOW, - ): - self._num_colors = len(colors) - self._colors = colors - self._color_idx = 0 - super().__init__(pixel_object, speed, 0, size, spacing, reverse, name) - - def bar_color(self, n, pixel_no=0): - return self._colors[self._color_idx - (n % len(self._colors))] - - def on_cycle_complete(self): - self._color_idx = (self._color_idx + self._direction) % len(self._colors) - super().on_cycle_complete() From 9d2b2062c37463eafacaef618a2305bfb3ca5910 Mon Sep 17 00:00:00 2001 From: cjsieh Date: Fri, 19 Jun 2020 21:28:19 -0500 Subject: [PATCH 17/20] Add files via upload change from CustomColorsChase to CustomColorChase --- examples/led_animation_all_animations.py | 8 ++- examples/led_animation_customcolorchase.py | 60 ++++++++++++++++++++++ 2 files changed, 63 insertions(+), 5 deletions(-) create mode 100644 examples/led_animation_customcolorchase.py diff --git a/examples/led_animation_all_animations.py b/examples/led_animation_all_animations.py index 3b7a20e..0d55804 100644 --- a/examples/led_animation_all_animations.py +++ b/examples/led_animation_all_animations.py @@ -21,7 +21,7 @@ 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.customcolorschase import CustomColorsChase +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 @@ -44,9 +44,7 @@ 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_colors_chase = CustomColorsChase( - pixels, speed=0.1, size=2, spacing=3, colors=[ORANGE, WHITE, JADE] -) +custom_color_chase = CustomColorChase(pixels, speed=0.1, size=2, spacing=3,colors=[ORANGE, WHITE, JADE]) animations = AnimationSequence( @@ -61,7 +59,7 @@ rainbow_comet, sparkle_pulse, rainbow_chase, - custom_colors_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..85b4e9e --- /dev/null +++ b/examples/led_animation_customcolorchase.py @@ -0,0 +1,60 @@ +""" +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 +# colorwheel only needed for rainbowchase example +from adafruit_led_animation.color import colorwheel +# Colors for customcolorchase examples +from adafruit_led_animation.color import PINK, GREEN, RED, 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 = 30 +brightness = 0.3 + +pixels = neopixel.NeoPixel( + pixel_pin, pixel_num, brightness=brightness, auto_write=False +) + +# colors default to RAINBOW as defined in color.py +custom_color_chase_rainbow = CustomColorChase(pixels, speed=0.1, size=2, spacing=3) +custom_color_chase_rainbow_r = CustomColorChase(pixels, speed=0.1, size=3, spacing=3,reverse=True) + +# Example with same colors as RainbowChase +steps=30 +#This was taken from rainbowchase.py +rainbow_colors = [colorwheel(n % 256) for n in range(0, 512, steps)] +#Now use rainbow_colors with CustomColorChase +custom_color_chase_rainbowchase = CustomColorChase(pixels, speed=0.1, colors=rainbow_colors, size=2, spacing=3) + +custom_color_chase_bgp = CustomColorChase( + pixels, speed=0.1, colors=[BLUE, GREEN, PINK], size=3, spacing=2 +) + +# Can use integer values for color, 0 is black +custom_color_chase_br = CustomColorChase( + pixels, speed=0.1, colors=[BLUE, 0, RED, 0], size=2, spacing=0 ) + +animations = AnimationSequence( + custom_color_chase_rainbow, + custom_color_chase_rainbow_r, + custom_color_chase_rainbowchase, + custom_color_chase_bgp, + custom_color_chase_br, + advance_interval=6, + #advance_on_cycle_complete=True, + auto_clear=True, +) + +while True: + animations.animate() From 1d0b9dad1e2c735855aa9a67a8d0fd6334cc9c81 Mon Sep 17 00:00:00 2001 From: cjsieh Date: Fri, 19 Jun 2020 21:28:57 -0500 Subject: [PATCH 18/20] Delete led_animation_customcolorschase.py changed from ccustomcolorschase to customcolorchase --- examples/led_animation_customcolorschase.py | 61 --------------------- 1 file changed, 61 deletions(-) delete mode 100644 examples/led_animation_customcolorschase.py diff --git a/examples/led_animation_customcolorschase.py b/examples/led_animation_customcolorschase.py deleted file mode 100644 index 76aa7e2..0000000 --- a/examples/led_animation_customcolorschase.py +++ /dev/null @@ -1,61 +0,0 @@ -""" -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.customcolorschase import CustomColorsChase -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_colors_chase_rainbow = CustomColorsChase(pixels, speed=0.1, size=2, spacing=3) -# Patriotic -custom_colors_chase_rwb = CustomColorsChase( - pixels, speed=0.1, colors=[RED, WHITE, BLUE], size=2, spacing=3 -) -# St Pat Day -custom_colors_chase_gw = CustomColorsChase( - pixels, speed=0.1, colors=[GREEN, WHITE], size=2, spacing=3 -) -# Christmas -custom_colors_chase_rg = CustomColorsChase( - pixels, speed=0.1, colors=[RED, GREEN], size=2, spacing=3 -) -custom_colors_chase_rg_r = CustomColorsChase( - pixels, speed=0.1, colors=[RED, GREEN], size=1, spacing=2, reverse=True -) -# Valentines Day -custom_colors_chase_rp = CustomColorsChase( - pixels, speed=0.1, colors=[RED, PINK], size=2, spacing=3 -) - - -animations = AnimationSequence( - custom_colors_chase_rainbow, - custom_colors_chase_rp, - custom_colors_chase_gw, - custom_colors_chase_rwb, - custom_colors_chase_rg, - custom_colors_chase_rg_r, - advance_interval=6, - auto_clear=True, -) - -while True: - animations.animate() From 1a600cf7994c4c445cf0bef3abc2057358eb36f1 Mon Sep 17 00:00:00 2001 From: cjsieh Date: Fri, 19 Jun 2020 21:40:51 -0500 Subject: [PATCH 19/20] Add files via upload prefixed "black" formating --- examples/led_animation_all_animations.py | 4 +++- examples/led_animation_customcolorchase.py | 21 ++++++++++++++------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/examples/led_animation_all_animations.py b/examples/led_animation_all_animations.py index 0d55804..5eb8287 100644 --- a/examples/led_animation_all_animations.py +++ b/examples/led_animation_all_animations.py @@ -44,7 +44,9 @@ 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]) +custom_color_chase = CustomColorChase( + pixels, speed=0.1, size=2, spacing=3, colors=[ORANGE, WHITE, JADE] +) animations = AnimationSequence( diff --git a/examples/led_animation_customcolorchase.py b/examples/led_animation_customcolorchase.py index 85b4e9e..449179a 100644 --- a/examples/led_animation_customcolorchase.py +++ b/examples/led_animation_customcolorchase.py @@ -11,8 +11,10 @@ from adafruit_led_animation.animation.customcolorchase import CustomColorChase from adafruit_led_animation.sequence import AnimationSequence + # colorwheel only needed for rainbowchase example from adafruit_led_animation.color import colorwheel + # Colors for customcolorchase examples from adafruit_led_animation.color import PINK, GREEN, RED, BLUE @@ -28,14 +30,18 @@ # colors default to RAINBOW as defined in color.py custom_color_chase_rainbow = CustomColorChase(pixels, speed=0.1, size=2, spacing=3) -custom_color_chase_rainbow_r = CustomColorChase(pixels, speed=0.1, size=3, spacing=3,reverse=True) +custom_color_chase_rainbow_r = CustomColorChase( + pixels, speed=0.1, size=3, spacing=3, reverse=True +) # Example with same colors as RainbowChase -steps=30 -#This was taken from rainbowchase.py +steps = 30 +# This was taken from rainbowchase.py rainbow_colors = [colorwheel(n % 256) for n in range(0, 512, steps)] -#Now use rainbow_colors with CustomColorChase -custom_color_chase_rainbowchase = CustomColorChase(pixels, speed=0.1, colors=rainbow_colors, size=2, spacing=3) +# Now use rainbow_colors with CustomColorChase +custom_color_chase_rainbowchase = CustomColorChase( + pixels, speed=0.1, colors=rainbow_colors, size=2, spacing=3 +) custom_color_chase_bgp = CustomColorChase( pixels, speed=0.1, colors=[BLUE, GREEN, PINK], size=3, spacing=2 @@ -43,7 +49,8 @@ # Can use integer values for color, 0 is black custom_color_chase_br = CustomColorChase( - pixels, speed=0.1, colors=[BLUE, 0, RED, 0], size=2, spacing=0 ) + pixels, speed=0.1, colors=[BLUE, 0, RED, 0], size=2, spacing=0 +) animations = AnimationSequence( custom_color_chase_rainbow, @@ -52,7 +59,7 @@ custom_color_chase_bgp, custom_color_chase_br, advance_interval=6, - #advance_on_cycle_complete=True, + # advance_on_cycle_complete=True, auto_clear=True, ) From a8ad8eba2c46a49154a6d6a506b459f2c161b4a1 Mon Sep 17 00:00:00 2001 From: cjsieh Date: Fri, 19 Jun 2020 22:04:36 -0500 Subject: [PATCH 20/20] Add files via upload fixed description removed reference to advance_on_cycle_complete as not used now --- examples/led_animation_customcolorchase.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/led_animation_customcolorchase.py b/examples/led_animation_customcolorchase.py index 449179a..bc9d891 100644 --- a/examples/led_animation_customcolorchase.py +++ b/examples/led_animation_customcolorchase.py @@ -1,5 +1,5 @@ """ -This example displays the basic animations in sequence, at a five second interval. +This example displays custom color chase animations in sequence, at a six second interval. For NeoPixel FeatherWing. Update pixel_pin and pixel_num to match your wiring if using a different form of NeoPixels. @@ -59,7 +59,6 @@ custom_color_chase_bgp, custom_color_chase_br, advance_interval=6, - # advance_on_cycle_complete=True, auto_clear=True, )