button.pull = Pull.UP

#  neopixel setup
pixel_pin = board.D0
pixel_num = 9

pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=0.3, auto_write=False)

#  variable for number of pixels in the pixelmap helper
num = 1

#  pixel map helper
#  allows you to light each candle up one by one
#  begins with one being lit (num)
candles = helper.PixelMap.horizontal_lines(
    pixels, num, 1, helper.horizontal_strip_gridmap(pixel_num, alternating=False)
)

#  rainbow animation
rainbow = Rainbow(candles, speed=0.1, period=5)

animations = AnimationSequence(rainbow)

#  turn on center candle
pixels[4] = AMBER
pixels.show()

while True:

    #  if only one candle is lit, don't rewrite center neopixel
    if num == 1:
Ejemplo n.º 2
0
from adafruit_led_animation.animation.colorcycle import ColorCycle
from adafruit_led_animation.sequence import AnimationSequence
from adafruit_led_animation import helper
from adafruit_led_animation.color import PURPLE, AQUA, RED, JADE, ORANGE, YELLOW, BLUE

#Setup NeoPixels
pixel_pin = board.D6
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)
Ejemplo n.º 3
0
from adafruit_led_animation.sequence import AnimationSequence
from adafruit_led_animation import helper
from adafruit_led_animation.color import PURPLE, JADE, AMBER

# 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)

pixel_wing_vertical = helper.PixelMap.vertical_lines(
    pixels, 8, 4, helper.horizontal_strip_gridmap(8, alternating=False))
pixel_wing_horizontal = helper.PixelMap.horizontal_lines(
    pixels, 8, 4, helper.horizontal_strip_gridmap(8, alternating=False))

comet_h = Comet(pixel_wing_horizontal,
                speed=0.1,
                color=PURPLE,
                tail_length=3,
                bounce=True)
comet_v = Comet(pixel_wing_vertical,
                speed=0.1,
                color=AMBER,
                tail_length=6,
                bounce=True)
chase_h = Chase(pixel_wing_horizontal,
                speed=0.1,