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