led_animation_basic_animations.py
1 # SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries 2 # SPDX-License-Identifier: MIT 3 4 """ 5 This example displays the basic animations in sequence, at a five second interval. 6 7 For NeoPixel FeatherWing. Update pixel_pin and pixel_num to match your wiring if using 8 a different form of NeoPixels. 9 10 This example may not work on SAMD21 (M0) boards. 11 """ 12 import board 13 import neopixel 14 15 from adafruit_led_animation.animation.solid import Solid 16 from adafruit_led_animation.animation.colorcycle import ColorCycle 17 from adafruit_led_animation.animation.blink import Blink 18 from adafruit_led_animation.animation.comet import Comet 19 from adafruit_led_animation.animation.chase import Chase 20 from adafruit_led_animation.animation.pulse import Pulse 21 from adafruit_led_animation.sequence import AnimationSequence 22 from adafruit_led_animation.color import ( 23 PURPLE, 24 WHITE, 25 AMBER, 26 JADE, 27 TEAL, 28 PINK, 29 MAGENTA, 30 ORANGE, 31 ) 32 33 # Update to match the pin connected to your NeoPixels 34 pixel_pin = board.D6 35 # Update to match the number of NeoPixels you have connected 36 pixel_num = 32 37 38 pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=0.5, auto_write=False) 39 40 solid = Solid(pixels, color=PINK) 41 blink = Blink(pixels, speed=0.5, color=JADE) 42 colorcycle = ColorCycle(pixels, speed=0.4, colors=[MAGENTA, ORANGE, TEAL]) 43 chase = Chase(pixels, speed=0.1, color=WHITE, size=3, spacing=6) 44 comet = Comet(pixels, speed=0.01, color=PURPLE, tail_length=10, bounce=True) 45 pulse = Pulse(pixels, speed=0.1, color=AMBER, period=3) 46 47 48 animations = AnimationSequence( 49 solid, 50 blink, 51 colorcycle, 52 chase, 53 comet, 54 pulse, 55 advance_interval=5, 56 auto_clear=True, 57 ) 58 59 while True: 60 animations.animate()