/ BusyBox_Sign / code.py
code.py
 1  # SPDX-FileCopyrightText: 2020 Noe Ruiz for Adafruit Industries
 2  #
 3  # SPDX-License-Identifier: MIT
 4  
 5  import time
 6  import board
 7  import neopixel
 8  from adafruit_led_animation.animation.comet import Comet
 9  from adafruit_led_animation.animation.pulse import Pulse
10  from adafruit_led_animation.animation.blink import Blink
11  from adafruit_led_animation.animation.rainbow import Rainbow
12  from adafruit_led_animation.animation.colorcycle import ColorCycle
13  from adafruit_led_animation.sequence import AnimationSequence
14  from adafruit_led_animation import helper
15  from adafruit_led_animation.color import PURPLE, AQUA, RED, JADE, ORANGE, YELLOW, BLUE
16  
17  #Setup NeoPixels
18  pixel_pin = board.D6
19  pixel_num = 16
20  pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=.9, auto_write=False)
21  
22  #Setup NeoPixel Grid
23  pixel_wing_vertical = helper.PixelMap.vertical_lines(
24      pixels, 8, 2, helper.horizontal_strip_gridmap(8, alternating=True)
25  )
26  pixel_wing_horizontal = helper.PixelMap.horizontal_lines(
27      pixels, 8, 2, helper.horizontal_strip_gridmap(8, alternating=True)
28  )
29  
30  #Setup LED Animations
31  rainbow = Rainbow(pixels, speed=.001, period=2)
32  pulse = Pulse(pixels, speed=0.1, color=RED, period=3)
33  blink = Blink(pixels, speed=0.5, color=RED)
34  colorcycle = ColorCycle(pixels, speed=0.4, colors=[RED, ORANGE, YELLOW, JADE, BLUE, AQUA, PURPLE])
35  comet_v = Comet(pixel_wing_vertical, speed=0.05, color=PURPLE, tail_length=6, bounce=True)
36  
37  #Setup the LED Sequences
38  animations = AnimationSequence(
39      rainbow,
40      pulse,
41      comet_v,
42      blink,
43      colorcycle,
44      advance_interval=5.95,
45  )
46  
47  #Run ze animations!
48  while True:
49      animations.animate()