/ examples / led_animation_sparkle_animations.py
led_animation_sparkle_animations.py
 1  # SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
 2  # SPDX-License-Identifier: MIT
 3  
 4  """
 5  This example uses AnimationsSequence to display multiple animations in sequence, at a five second
 6  interval.
 7  
 8  For NeoPixel FeatherWing. Update pixel_pin and pixel_num to match your wiring if using
 9  a different form of NeoPixels.
10  """
11  import board
12  import neopixel
13  
14  from adafruit_led_animation.animation.sparkle import Sparkle
15  from adafruit_led_animation.animation.sparklepulse import SparklePulse
16  from adafruit_led_animation.sequence import AnimationSequence
17  from adafruit_led_animation.color import AMBER, JADE
18  
19  # Update to match the pin connected to your NeoPixels
20  pixel_pin = board.D6
21  # Update to match the number of NeoPixels you have connected
22  pixel_num = 32
23  
24  pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=0.5, auto_write=False)
25  
26  sparkle = Sparkle(pixels, speed=0.05, color=AMBER, num_sparkles=10)
27  sparkle_pulse = SparklePulse(pixels, speed=0.05, period=3, color=JADE)
28  
29  animations = AnimationSequence(
30      sparkle,
31      sparkle_pulse,
32      advance_interval=5,
33      auto_clear=True,
34  )
35  
36  while True:
37      animations.animate()