Exemple #1
0
from adafruit_led_animation.animation.customcolorchase import CustomColorChase
from adafruit_led_animation.sequence import AnimationSequence
from adafruit_led_animation.color import PURPLE, WHITE, AMBER, JADE, MAGENTA, ORANGE

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

blink = Blink(pixels, speed=0.5, color=JADE)
colorcycle = ColorCycle(pixels, speed=0.4, colors=[MAGENTA, ORANGE])
comet = Comet(pixels, speed=0.01, color=PURPLE, tail_length=10, bounce=True)
chase = Chase(pixels, speed=0.1, size=3, spacing=6, color=WHITE)
pulse = Pulse(pixels, speed=0.1, period=3, color=AMBER)
sparkle = Sparkle(pixels, speed=0.1, color=PURPLE, num_sparkles=10)
solid = Solid(pixels, color=JADE)
rainbow = Rainbow(pixels, speed=0.1, period=2)
sparkle_pulse = SparklePulse(pixels, speed=0.1, period=3, color=JADE)
rainbow_comet = RainbowComet(pixels, speed=0.1, tail_length=7, bounce=True)
rainbow_chase = RainbowChase(pixels, speed=0.1, size=3, spacing=2, step=8)
rainbow_sparkle = RainbowSparkle(pixels, speed=0.1, num_sparkles=15)
custom_color_chase = CustomColorChase(pixels,
                                      speed=0.1,
                                      size=2,
                                      spacing=3,
                                      colors=[ORANGE, WHITE, JADE])
Exemple #2
0
                     stroke=2,
                     colors=c,
                     anim_mode="circular")

group = displayio.Group(max_size=4)
group.append(rect1)
group.append(rect2)
group.append(rect3)
group.append(rect4)

display.show(group)

pixels = rect1

blink = Blink(pixels, speed=0.5, color=0x00FF00)
colorcycle = ColorCycle(pixels, speed=0.4, colors=[MAGENTA, YELLOW])
comet = Comet(pixels, speed=0.01, color=PURPLE, tail_length=10, bounce=True)
chase = Chase(pixels, speed=0.1, size=3, spacing=6, color=WHITE)
#pulse = Pulse(pixels, speed=0.1, period=3, color=0x00FF00)
sparkle = Sparkle(pixels, speed=0.1, color=PURPLE, num_sparkles=10)
solid = Solid(pixels, color=0x00FF00)
#rainbow = Rainbow(pixels, speed=0.1, period=2)
sparkle_pulse = SparklePulse(pixels, speed=0.1, period=3, color=0x00FF00)
rainbow_comet = RainbowComet(pixels, speed=0.1, tail_length=7, bounce=True)
rainbow_chase = RainbowChase(pixels, speed=0.1, size=3, spacing=2, step=8)
#rainbow_sparkle = RainbowSparkle(pixels, speed=0.1, num_sparkles=15)
custom_color_chase = CustomColorChase(pixels,
                                      speed=0.1,
                                      size=2,
                                      spacing=3,
                                      colors=[ORANGE, WHITE, JADE])
Exemple #3
0
                           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)

#Setup the LED Sequences
animations = AnimationSequence(
    rainbow,
    pulse,
    comet_v,
    blink,
    colorcycle,
    advance_interval=5.95,
magtag = MagTag()
boardPixels = magtag.peripherals.neopixels
boardPixels.brightness = boardBrightness
magtag.peripherals.neopixel_disable = False
stripPixels = neopixel.NeoPixel(stripPin,
                                stripCnt,
                                brightness=stripBrightness,
                                auto_write=False)

###   Animation Sequences & Groups   ###
# Creates and organizes the animations

animations = AnimationSequence(
    AnimationGroup(
        Solid(boardPixels, WHITE),
        ColorCycle(stripPixels, cycleSpeed, cycleColors),
        sync=True,
    ),
    AnimationSequence(
        AnimateOnce(
            AnimationGroup(
                Solid(boardPixels, WHITE),
                Comet(stripPixels,
                      stripCometSpeed,
                      cometColorA,
                      tail_length=stripCometTailLen),
            ),
            AnimationGroup(
                Solid(boardPixels, WHITE),
                Comet(stripPixels,
                      stripCometSpeed,
Exemple #5
0
# Display setup

matrix = Matrix(bit_depth=5)
display = matrix.display

# 114 colors is the minimum value for all the rainbow animations. 128 use same memory.
rect1 = anisha.Arect(16, 1, 30, 30, outline=0x004000, stroke=2, colors=128)

group = displayio.Group()
group.append(rect1)

display.show(group)

blink = Blink(rect1, speed=0.5, color=JADE)
colorcycle = ColorCycle(rect1, speed=0.4, colors=[MAGENTA, ORANGE])
comet = Comet(rect1, speed=0.01, color=PURPLE, tail_length=10, bounce=True)
chase = Chase(rect1, speed=0.1, size=3, spacing=6, color=WHITE)
pulse = Pulse(rect1, speed=0.1, period=3, color=AMBER)
sparkle = Sparkle(rect1, speed=0.1, color=PURPLE, num_sparkles=10)
solid = Solid(rect1, color=JADE)
rainbow = Rainbow(rect1, speed=0.1, period=2)
sparkle_pulse = SparklePulse(rect1, speed=0.1, period=3, color=JADE)
rainbow_comet = RainbowComet(rect1, speed=0.1, tail_length=7, bounce=True)
rainbow_chase = RainbowChase(rect1, speed=0.1, size=3, spacing=2, step=8)
rainbow_sparkle = RainbowSparkle(rect1, speed=0.1, num_sparkles=15)
custom_color_chase = CustomColorChase(rect1,
                                      speed=0.1,
                                      size=2,
                                      spacing=3,
                                      colors=[ORANGE, WHITE, JADE])
# Setup MagTag library.
magtag = MagTag()

# Setup pixels.
pixels = magtag.peripherals.neopixels
pixels.brightness = pixel_brightness
magtag.peripherals.neopixel_disable = False
strip = neopixel.NeoPixel(strip_pin,
                          strip_num,
                          brightness=strip_brightness,
                          auto_write=False)

# Create animations in sequences and groups.
animations = AnimationSequence(
    AnimationGroup(
        ColorCycle(pixels, cycle_speed, color_cycle_colors),
        ColorCycle(strip, cycle_speed, color_cycle_colors),
        sync=True,
    ),
    AnimationGroup(
        Sparkle(pixels, sparkle_speed, sparkle_color, 15),
        Sparkle(strip, sparkle_speed, sparkle_color, 1),
    ),
    AnimationSequence(
        AnimateOnce(
            AnimationGroup(
                Comet(pixels,
                      magtag_comet_speed,
                      comet_one_color,
                      tail_length=magtag_comet_tail),
                Comet(strip,