# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries # SPDX-License-Identifier: MIT """ This example blinks the LEDs purple at a 0.5 second interval. For QT Py Haxpress and a NeoPixel strip. Update pixel_pin and pixel_num to match your wiring if using a different board or form of NeoPixels. This example will run on SAMD21 (M0) Express boards (such as Circuit Playground Express or QT Py Haxpress), but not on SAMD21 non-Express boards (such as QT Py or Trinket). """ import board import neopixel from adafruit_led_animation.animation.blink import Blink from adafruit_led_animation.color import PURPLE # Update to match the pin connected to your NeoPixels pixel_pin = board.A3 # Update to match the number of NeoPixels you have connected pixel_num = 30 pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=0.5, auto_write=False) blink = Blink(pixels, speed=0.5, color=PURPLE) while True: blink.animate()
outline=0x004000, stroke=2, colors=c, anim_mode="circular") group = displayio.Group(max_size=4) group.append(rect1) group.append(rect2) group.append(rect3) group.append(rect4) display.show(group) pixels = rect1 blink = Blink(pixels, speed=0.5, color=0x00FF00) colorcycle = ColorCycle(pixels, speed=0.4, colors=[MAGENTA, YELLOW]) comet = Comet(pixels, speed=0.01, color=PURPLE, tail_length=10, bounce=True) chase = Chase(pixels, speed=0.1, size=3, spacing=6, color=WHITE) #pulse = Pulse(pixels, speed=0.1, period=3, color=0x00FF00) sparkle = Sparkle(pixels, speed=0.1, color=PURPLE, num_sparkles=10) solid = Solid(pixels, color=0x00FF00) #rainbow = Rainbow(pixels, speed=0.1, period=2) sparkle_pulse = SparklePulse(pixels, speed=0.1, period=3, color=0x00FF00) 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,
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 # 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) blink = Blink(pixels, speed=0.5, color=JADE) colorcycle = ColorCycle(pixels, speed=0.4, colors=[MAGENTA, ORANGE]) comet = Comet(pixels, speed=0.01, color=PURPLE, tail_length=10, bounce=True) chase = Chase(pixels, speed=0.1, size=3, spacing=6, color=WHITE) pulse = Pulse(pixels, speed=0.1, period=3, color=AMBER) sparkle = Sparkle(pixels, speed=0.1, color=PURPLE, num_sparkles=10) solid = Solid(pixels, color=JADE) rainbow = Rainbow(pixels, speed=0.1, period=2) 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,
pixel_num = 16 pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=.9, auto_write=False) #Setup NeoPixel Grid pixel_wing_vertical = helper.PixelMap.vertical_lines( pixels, 8, 2, helper.horizontal_strip_gridmap(8, alternating=True)) pixel_wing_horizontal = helper.PixelMap.horizontal_lines( pixels, 8, 2, helper.horizontal_strip_gridmap(8, alternating=True)) #Setup LED Animations rainbow = Rainbow(pixels, speed=.001, period=2) pulse = Pulse(pixels, speed=0.1, color=RED, period=3) blink = Blink(pixels, speed=0.5, color=RED) colorcycle = ColorCycle(pixels, speed=0.4, colors=[RED, ORANGE, YELLOW, JADE, BLUE, AQUA, PURPLE]) comet_v = Comet(pixel_wing_vertical, speed=0.05, color=PURPLE, tail_length=6, bounce=True) #Setup the LED Sequences animations = AnimationSequence( rainbow, pulse, comet_v, blink,
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries # SPDX-License-Identifier: MIT """ This simpletest example displays the Blink animation. For NeoPixel FeatherWing. Update pixel_pin and pixel_num to match your wiring if using a different form of NeoPixels. """ import board import neopixel from adafruit_led_animation.animation.blink import Blink from adafruit_led_animation.color import RED # 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) blink = Blink(pixels, speed=0.5, color=RED) while True: blink.animate()
from adafruit_led_animation.color import PURPLE, WHITE, AMBER, JADE, MAGENTA, ORANGE # Display setup matrix = Matrix(bit_depth=5) display = matrix.display # 114 colors is the minimum value for all the rainbow animations. 128 use same memory. rect1 = anisha.Arect(16, 1, 30, 30, outline=0x004000, stroke=2, colors=128) group = displayio.Group() group.append(rect1) display.show(group) blink = Blink(rect1, speed=0.5, color=JADE) colorcycle = ColorCycle(rect1, speed=0.4, colors=[MAGENTA, ORANGE]) comet = Comet(rect1, speed=0.01, color=PURPLE, tail_length=10, bounce=True) chase = Chase(rect1, speed=0.1, size=3, spacing=6, color=WHITE) pulse = Pulse(rect1, speed=0.1, period=3, color=AMBER) sparkle = Sparkle(rect1, speed=0.1, color=PURPLE, num_sparkles=10) solid = Solid(rect1, color=JADE) rainbow = Rainbow(rect1, speed=0.1, period=2) sparkle_pulse = SparklePulse(rect1, speed=0.1, period=3, color=JADE) rainbow_comet = RainbowComet(rect1, speed=0.1, tail_length=7, bounce=True) rainbow_chase = RainbowChase(rect1, speed=0.1, size=3, spacing=2, step=8) rainbow_sparkle = RainbowSparkle(rect1, speed=0.1, num_sparkles=15) custom_color_chase = CustomColorChase(rect1, speed=0.1, size=2, spacing=3,
from adafruit_led_animation.group import AnimationGroup from adafruit_led_animation.sequence import AnimationSequence import adafruit_led_animation.color as color strip_pixels = neopixel.NeoPixel(board.A1, 30, brightness=0.5, auto_write=False) cp.pixels.brightness = 0.5 animations = AnimationSequence( # Synchronized to 0.5 seconds. Ignores the second animation setting of 3 seconds. AnimationGroup( Blink(cp.pixels, 0.5, color.CYAN), Blink(strip_pixels, 3.0, color.AMBER), sync=True, ), # Different speeds AnimationGroup( Comet(cp.pixels, 0.1, color.MAGENTA, tail_length=5), Comet(strip_pixels, 0.01, color.MAGENTA, tail_length=15), ), # Different animations AnimationGroup( Blink(cp.pixels, 0.5, color.JADE), Comet(strip_pixels, 0.05, color.TEAL, tail_length=15), ), # Sequential animations on the built-in NeoPixels then the NeoPixel strip Chase(cp.pixels, 0.05, size=2, spacing=3, color=color.PURPLE),
import adafruit_led_animation.color as color strip_pixels = neopixel.NeoPixel(board.A1, 16, brightness=0.5, auto_write=False) cp.pixels.brightness = 0.5 animations = AnimationSequence( # Synchronized to 0.5 seconds. Ignores the second animation setting of 3 seconds. AnimationGroup( Sparkle(cp.pixels, 0.1, color.GREEN, num_sparkles=1), Sparkle(strip_pixels, 0.1, color.GREEN, num_sparkles=1), ), AnimationGroup( Blink(cp.pixels, 0.25, color.RED), Blink(strip_pixels, 0.25, color.RED), sync=True, ), # Different speeds AnimationGroup( Comet(cp.pixels, 0.05, color.GREEN, tail_length=5), Comet(strip_pixels, 0.05, color.GREEN, tail_length=5), ), AnimationGroup( Pulse(cp.pixels, 0.05, color.RED, period=3), Pulse(strip_pixels, 0.05, color.RED, period=3), ), advance_interval=4.0, auto_clear=True, auto_reset=True,
animations = AnimationSequence( AnimationGroup( Sparkle(magtag_pixels, speed=0.1, color=sparkle_color, num_sparkles=1), Sparkle(strip_pixels, speed=0.01, color=sparkle_color, num_sparkles=15), ) ) # If cyan or purple, do a blink animation in the specified color. if cheerlights_color in ('cyan', 'purple'): if cheerlights_color == 'cyan': blink_color = CYAN elif cheerlights_color == 'purple': blink_color = PURPLE animations = AnimationSequence( AnimationGroup( Blink(magtag_pixels, speed=0.5, color=blink_color), Blink(strip_pixels, speed=0.5, color=blink_color), ) ) # If white or yellow, do a chase animation in the specified color. if cheerlights_color in ('white', 'yellow'): if cheerlights_color == 'white': chase_color = WHITE elif cheerlights_color == 'yellow': chase_color = YELLOW animations = AnimationSequence( AnimationGroup( Chase(magtag_pixels, speed=0.1, size=2, spacing=1, color=chase_color), Chase(strip_pixels, speed=0.1, size=3, spacing=2, color=chase_color), )
matrix = Matrix(bit_depth=5) display = matrix.display # delay in secs d = 7 # number of colors c = 128 poly1 = anisha.Apoly([(0, 0), (7, 31), (15, 2), (23, 31), (31, 2), (39, 31), (47, 2), (55, 31), (63, 0)], outline=0xFF0000, colors=c) group = displayio.Group(max_size=4) group.append(poly1) display.show(group) blink = Blink(poly1, speed=0.5, color=0x00FF00) comet = Comet(poly1, speed=0.01, color=PURPLE, tail_length=10, bounce=True) animations = AnimationSequence(comet, blink, advance_interval=d, auto_clear=True) while True: animations.animate()
# Setup for sparkle animation SPARKLE_SPEED = 0.03 # Lower numbers increase the animation speed # Create the NeoPixel strip strip_pixels = neopixel.NeoPixel(board.A1, STRIP_PIXEL_NUMBER, auto_write=False) # Setup BLE connection ble = BLERadio() uart = UARTService() advertisement = ProvideServicesAdvertisement(uart) # Setup animations animations = AnimationSequence( AnimationGroup(Blink(cpb.pixels, BLINK_SPEED, BLINK_INITIAL_COLOR), Blink(strip_pixels, BLINK_SPEED, BLINK_INITIAL_COLOR), sync=True), AnimationGroup( Comet(cpb.pixels, COMET_SPEED, color.MAGENTA, tail_length=CPB_COMET_TAIL_LENGTH, bounce=CPB_COMET_BOUNCE), Comet(strip_pixels, COMET_SPEED, color.MAGENTA, tail_length=STRIP_COMET_TAIL_LENGTH, bounce=STRIP_COMET_BOUNCE)), AnimationGroup(Sparkle(cpb.pixels, SPARKLE_SPEED, color.PURPLE), Sparkle(strip_pixels, SPARKLE_SPEED, color.PURPLE)),
15, 15, start_angle=180, end_angle=360, angle_offset=0, outline=0xFF0000) circle1 = anisha.Acircle(46, 18, 13, outline=0x0000FF, angle_offset=90) group = displayio.Group(max_size=4) group.append(ellipse1) group.append(arc1) group.append(circle1) display.show(group) blink1 = Blink(arc1, speed=0.3, color=0xFF0000) blink2 = Blink(ellipse1, speed=0.7, color=0x004000) blink3 = Blink(circle1, speed=0.5, color=0x0000FF) comet1 = Comet(ellipse1, speed=0.01, color=PURPLE, tail_length=10, bounce=True) comet2 = Comet(arc1, speed=0.01, color=PURPLE, tail_length=10, bounce=True) comet3 = Comet(circle1, speed=0.01, color=PURPLE, tail_length=10, bounce=True) animations = AnimationSequence(AnimationGroup(blink1, blink2, blink3), AnimationGroup(comet1, comet2, comet3), advance_interval=d, auto_clear=True) time.sleep(10) while True: