import board
import neopixel
from adafruit_led_animation.animation.pulse import Pulse
from adafruit_led_animation.animation.rainbow import Rainbow
from adafruit_led_animation.animation.rainbowsparkle import RainbowSparkle
from adafruit_led_animation.animation.rainbowcomet import RainbowComet
from adafruit_led_animation.sequence import AnimationSequence
from adafruit_led_animation.color import PURPLE

# Update this to match the number of NeoPixel LEDs connected to your board.
num_pixels = 124

pixels = neopixel.NeoPixel(board.GP1, num_pixels, auto_write=True)
pixels.brightness = 0.2

rainbow = Rainbow(pixels, speed=0.01, period=1)
rainbow_sparkle = RainbowSparkle(pixels, speed=0.05, num_sparkles=15)
rainbow_comet = RainbowComet(pixels, speed=.01, tail_length=20, bounce=True)
pulse = Pulse(pixels, speed=.05, color=PURPLE, period=3)

animations = AnimationSequence(pulse,
                               rainbow_sparkle,
                               rainbow_comet,
                               rainbow,
                               advance_interval=5,
                               auto_clear=True,
                               random_order=False)

while True:
    animations.animate()
예제 #2
0
CP_RAINBOW = Rainbow(cp.pixels, speed=0.01, period=10, step=3)
CRYSTAL_COMET = Comet(PIXEL_MAP_CRYSTALS, speed=SPEED, tail_length=8,
                      color=PURPLE, bounce=True)
DARK_RINGS = Solid(PIXELS, color=BLACK)
DARK_CPB = Solid(cp.pixels, color=BLACK)
DARK = AnimationGroup(
        DARK_RINGS,
        DARK_CPB,
        )

# Animations Playlist, reorder as desired. AnimationGroups play at same time
ANIMATIONS = AnimationSequence(
    AnimationGroup(
        CRYSTAL_COMET,
        RAINBOW,
        CP_RAINBOW,
        ),
    auto_clear=True,
    auto_reset=True,
)

# MAIN LOOP ----------------------------------------------------------------

LAST_POSITION = ENCODER.position
MODE = 1
while True:

    POSITION = ENCODER.position
    if POSITION != LAST_POSITION:
        MOVE = POSITION - LAST_POSITION
        if cp.switch:
# Cap touch board setup   ------------------------------------------------------
i2c = busio.I2C(board.SCL, board.SDA)
mpr121 = adafruit_mpr121.MPR121(i2c)

# Demo MODE LED Animations  ------------------------------------------------------
rainbow = Rainbow(pixels, speed=0, period=10, name="rainbow", step=1)
rainbow_chase = RainbowChase(pixels, speed=0, size=5, spacing=10)
chase = Chase(pixels, speed=0.1, color=RED, size=1, spacing=6)
rainbow_comet = RainbowComet(pixels, speed=0.01, tail_length=60, bounce=True)

# Animation Sequence Playlist -- rearrange to change the order of animations

animations = AnimationSequence(
    rainbow_chase,
    chase,
    rainbow_comet,
    auto_clear=True,
    auto_reset=True,
)

def go_dark():
    '''set all pixels to black'''
    pixels.fill(BLACK)
    pixels.show()


# Debouncer ------------------------------------------------------

buttons = [Debouncer(mpr121[i]) for i in range(12)]

# Create the NeoPixel strip
strip_pixels = neopixel.NeoPixel(board.D5,
                                 STRIP_PIXEL_NUMBER,
                                 auto_write=False)

# Setup BLE connection
ble = BLERadio()
uart = UARTService()
advertisement = ProvideServicesAdvertisement(uart)

# Setup animations
animations = AnimationSequence(
    AnimationGroup(Sparkle(strip_pixels, SPARKLE_SPEED, color.TEAL)),
    AnimationGroup(
        Comet(strip_pixels,
              COMET_SPEED,
              color.TEAL,
              tail_length=STRIP_COMET_TAIL_LENGTH,
              bounce=STRIP_COMET_BOUNCE)),
)

animation_color = None
mode = 0
blanked = False

while True:
    ble.start_advertising(advertisement)  # Start advertising.
    was_connected = False
    while not was_connected or ble.connected:
        if not blanked:  # If LED-off signal is not being sent...
            animations.animate()  # Run the animations.
# SPDX-FileCopyrightText: 2021 Rose Hooper
# SPDX-License-Identifier: MIT

import board
from adafruit_led_animation.animation.sparkle import Sparkle
from adafruit_led_animation.color import PURPLE
from adafruit_led_animation.sequence import AnimationSequence

from adafruit_is31fl3741.adafruit_ledglasses import MUST_BUFFER, LED_Glasses
from adafruit_is31fl3741.led_glasses_animation import LED_Glasses_Animation

glasses = LED_Glasses(board.I2C(), allocate=MUST_BUFFER)
glasses.set_led_scaling(255)
glasses.global_current = 0xFE
glasses.enable = True

pixels = LED_Glasses_Animation(glasses)

anim2 = Sparkle(pixels, 0.05, PURPLE)

group = AnimationSequence(anim2,
                          advance_interval=5,
                          auto_reset=True,
                          auto_clear=True)
while True:
    group.animate()
interval.

For NeoPixel FeatherWing. Update pixel_pin and pixel_num to match your wiring if using
a different form of NeoPixels.
"""
import board
import neopixel

from adafruit_led_animation.animation.blink import Blink
from adafruit_led_animation.animation.comet import Comet
from adafruit_led_animation.animation.chase import Chase
from adafruit_led_animation.sequence import AnimationSequence
from adafruit_led_animation.color import PURPLE, AMBER, JADE

# 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)
comet = Comet(pixels, speed=0.01, color=PURPLE, tail_length=10, bounce=True)
chase = Chase(pixels, speed=0.1, size=3, spacing=6, color=AMBER)


animations = AnimationSequence(blink, comet, chase, advance_interval=3, auto_clear=True)

while True:
    animations.animate()
예제 #7
0
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])

animations = AnimationSequence(
    comet,
    blink,
    rainbow_sparkle,
    chase,
    pulse,
    sparkle,
    rainbow,
    solid,
    rainbow_comet,
    sparkle_pulse,
    rainbow_chase,
    custom_color_chase,
    advance_interval=5,
    auto_clear=True,
)

while True:
    animations.animate()
fire = AnimationGroup(
    Comet(pixels, speed=0, tail_length=1, color=BLACK),
    Sparkle(pixels, speed=0.05, num_sparkles=10, color=AMBER),
    Sparkle(pixels, speed=0.05, num_sparkles=10, color=RED),
    Sparkle(pixels, speed=0.05, num_sparkles=20, color=ORANGE),
    Sparkle(pixels, speed=0.05, num_sparkles=5, color=0xFF7D13),
    Sparkle(pixels, speed=0.05, num_sparkles=10, color=BLACK),
)

# Here is the animation playlist where you set the order of modes

animations = AnimationSequence(
    readingLight,
    fire,
    rainbow,
    starrynight,
    rainbowfade,
    brightWhite,
    auto_clear=True,
)

MODE = 0

while True:
    if MODE == 0:  # If currently off...
        startup.animate()
        while startup.animate():
            pass
        MODE = 1
    # Advertise when not connected
# the keyboard object!
cc = ConsumerControl(usb_hid.devices)
# our array of button objects
buttons = []

# make all pin objects, make them inputs w/pullups
for pin in buttonpins:
    button = digitalio.DigitalInOut(pin)
    button.direction = digitalio.Direction.INPUT
    button.pull = digitalio.Pull.UP
    buttons.append(button)

animations = AnimationSequence(
    AnimationGroup(
        Pulse(pixels, speed=0.05, color=WHITE, period=6),
        Solid(internal_pixel, color=BLACK),
    ), )

print("Waiting for button presses")

while True:
    # animate neopixel jewel
    animations.animate()
    # check each button
    for button in buttons:
        if not button.value:  # pressed?
            i = buttons.index(button)

            print("Button #%d Pressed" % i)
예제 #10
0
                                 brightness=0.5,
                                 auto_write=False)
cp.pixels.brightness = 0.5

animations = AnimationSequence(
    # Synchronized to 0.5 seconds. Ignores the second animation setting of 3 seconds.
    AnimationGroup(
        Sparkle(cp.pixels, 0.1, color.GREEN, num_sparkles=1),
        Sparkle(strip_pixels, 0.1, color.GREEN, num_sparkles=1),
    ),
    AnimationGroup(
        Blink(cp.pixels, 0.25, color.RED),
        Blink(strip_pixels, 0.25, color.RED),
        sync=True,
    ),
    # Different speeds
    AnimationGroup(
        Comet(cp.pixels, 0.05, color.GREEN, tail_length=5),
        Comet(strip_pixels, 0.05, color.GREEN, tail_length=5),
    ),
    AnimationGroup(
        Pulse(cp.pixels, 0.05, color.RED, period=3),
        Pulse(strip_pixels, 0.05, color.RED, period=3),
    ),
    advance_interval=4.0,
    auto_clear=True,
    auto_reset=True,
)

while True:
    animations.animate()
For NeoPixel FeatherWing. Update pixel_pin and pixel_num to match your wiring if using
a different form of NeoPixels.
"""
import board
import neopixel

from adafruit_led_animation.animation.sparkle import Sparkle
from adafruit_led_animation.animation.sparklepulse import SparklePulse
from adafruit_led_animation.sequence import AnimationSequence
from adafruit_led_animation.color import AMBER, JADE

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

sparkle = Sparkle(pixels, speed=0.05, color=AMBER, num_sparkles=10)
sparkle_pulse = SparklePulse(pixels, speed=0.05, period=3, color=JADE)

animations = AnimationSequence(
    sparkle,
    sparkle_pulse,
    advance_interval=5,
    auto_clear=True,
)

while True:
    animations.animate()
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,
                      strip_comet_speed,
                      comet_one_color,
                      tail_length=strip_comet_tail),
            ),
            AnimationGroup(
                Comet(pixels,
                      magtag_comet_speed,
                      comet_two_color,
                      tail_length=magtag_comet_tail),
                Comet(strip,
                      strip_comet_speed,
                      comet_two_color,
                      tail_length=strip_comet_tail),
            ),
        ), ),
    AnimationGroup(
        # Turn the LEDs off.
        Solid(pixels, 0),
        Solid(strip, 0),
    ),
    auto_clear=True,
)
# Initialize servo
PWM = pwmio.PWMOut(SERVO_PIN, frequency=50)
SERVO = servo.Servo(PWM)

# Initialize NeoPixels and animations
PIXELS = neopixel.NeoPixel(PIXEL_PIN, NUM_PIXELS, auto_write=False,
                           pixel_order=ORDER)
LARSON = Comet(PIXELS, bounce=True, speed=0.6/NUM_PIXELS,
               tail_length=NUM_PIXELS//2,
               color=(RED[0] * BRIGHTNESS,  # This is a little faster than
                      RED[1] * BRIGHTNESS,  # using the NeoPixel brightness
                      RED[2] * BRIGHTNESS)) # setting.
SPARKLE = SparklePulse(PIXELS, period=2, speed=0.15,
                       max_intensity=BRIGHTNESS, color=BLUE)
ANIMATIONS = AnimationSequence(LARSON, SPARKLE, advance_interval=7,
                               auto_clear=False)

SERVO.angle = POSITION = NEXT_POSITION = 90
MOVING = False                # Initial state = paused
START_TIME = time.monotonic() # Initial time
DURATION = 1.0                # Hold initial position for 1 sec

while True: # Loop forever...

    # Move turret -- randomly looks around and pauses
    NOW = time.monotonic()
    ELAPSED = NOW - START_TIME # Seconds since start of motion or pause
    if ELAPSED >= DURATION:    # End motion/pause?
        MOVING = not MOVING    # Toggle between those two states
        START_TIME = NOW       # and record the new starting time
        ELAPSED = 0.0
예제 #14
0
            print("Response is", cheerlights_update_info)

            # Get the color from the fetched info for use below.
            cheerlights_color = cheerlights_update_info[0]

            # If red, blue or pink, do a comet animation in the specified color.
            if cheerlights_color in ('red', 'blue', 'pink'):
                if cheerlights_color == 'red':
                    comet_color = RED
                elif cheerlights_color == 'blue':
                    comet_color = BLUE
                elif cheerlights_color == 'pink':
                    comet_color = PINK
                animations = AnimationSequence(
                    AnimationGroup(
                        Comet(magtag_pixels, 0.3, color=comet_color, tail_length=3),
                        Comet(strip_pixels, 0.05, color=comet_color, tail_length=15),
                    )
                )

            # If green or orange, do a pulse animation in the specified color.
            if cheerlights_color in ('green', 'orange'):
                if cheerlights_color == 'green':
                    pulse_color = GREEN
                elif cheerlights_color == 'orange':
                    pulse_color = ORANGE
                animations = AnimationSequence(
                    AnimationGroup(
                        Pulse(magtag_pixels, speed=0.1, color=pulse_color, period=3),
                        Pulse(strip_pixels, speed=0.1, color=pulse_color, period=3),
                    )
                )
# Create a switch from the ItsyBity's on-board pushbutton to toggle charge mode
mode_pin = digitalio.DigitalInOut(board.SWITCH)
mode_pin.direction = digitalio.Direction.INPUT
mode_pin.pull = digitalio.Pull.UP
switch = Debouncer(mode_pin)

# Create the animations
comet = Comet(pixels, speed=0.06, color=(180,0,255), tail_length=10, bounce=True)
chase = Chase(pixels, speed=0.05, size=3, spacing=3, color=(0,255,255), reverse=True)
rainbow_comet = RainbowComet(pixels, speed=.06)
pulse = Pulse(pixels, speed=.04, color=(255,0,0), period = 0.2)


# Our animations sequence
seconds_per_animation = 10
animations = AnimationSequence(comet, rainbow_comet, chase, advance_interval=seconds_per_animation, auto_clear=True)
# Current display determines whether we are showing the animation sequence or the pulse animation
current_display = animations

# Mode changes the color of random animations randomly
random_color_mode = True

def random_animation_color(anims):
    if random_color_mode:
        anims.color = colorwheel(random.randint(0,255))
        
animations.add_cycle_complete_receiver(random_animation_color)


# After we complete three pulse cycles, return to main animations list
def pulse_finished(anim):
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:
        pass
    #  otherwise write data to center neopixel
    else:
        pixels[4] = AMBER
        pixels.show()
    #  animation the rainbow animation
예제 #17
0
    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,
)

#Run ze animations!
while True:
    animations.animate()
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,
                      cometColorB,
                      tail_length=stripCometTailLen),
            ),
            AnimationGroup(
                Solid(boardPixels, WHITE),
                Comet(stripPixels,
                      stripCometSpeed,
                      cometColorC,
                      tail_length=stripCometTailLen),
            ))),
    AnimationGroup(Solid(boardPixels, WHITE), Solid(stripPixels, AMBER)),
    AnimationGroup(
        Solid(boardPixels, AMBER),
        Solid(stripPixels, 0),
    ),
    auto_clear=True,
)
예제 #19
0
#rainbow_sparkle4 = RainbowSparkle(rect4, speed=0.1, num_sparkles=15)
custom_color_chase4 = CustomColorChase(rect4,
                                       speed=0.1,
                                       size=2,
                                       spacing=3,
                                       colors=[ORANGE, WHITE, JADE])

animations = AnimationSequence(AnimationGroup(comet, comet2, comet3, comet4),
                               AnimationGroup(blink, blink2, blink3, blink4),
                               AnimationGroup(colorcycle, colorcycle2,
                                              colorcycle3, colorcycle4),
                               AnimationGroup(chase, chase2, chase3, chase4),
                               AnimationGroup(sparkle, sparkle2, sparkle3,
                                              sparkle4),
                               AnimationGroup(solid, solid2, solid3, solid4),
                               AnimationGroup(rainbow_comet, rainbow_comet2,
                                              rainbow_comet3, rainbow_comet4),
                               AnimationGroup(sparkle_pulse, sparkle_pulse2,
                                              sparkle_pulse3, sparkle_pulse4),
                               AnimationGroup(rainbow_chase, rainbow_chase2,
                                              rainbow_chase3, rainbow_chase4),
                               AnimationGroup(custom_color_chase,
                                              custom_color_chase2,
                                              custom_color_chase3,
                                              custom_color_chase4),
                               advance_interval=d,
                               auto_clear=True)

while True:
    animations.animate()
예제 #20
0
                  step=3)
sparkle = Sparkle(pixels,
                  speed=speeds[current_speed],
                  color=WHITE,
                  name="sparkle")
rainbowfade = RainbowFade(pixels,
                          speed=speeds[current_speed],
                          name="rainbowfade")
solid = Solid(pixels, color=colorwheel(0), name="solid")

# Animation Sequence Playlist -- rearrange to change the order of animations

animations = AnimationSequence(
    rainbow,
    rainbowfade,
    solid,
    sparkle,
    auto_clear=True,
    auto_reset=True,
)

solid.speed = 0.01
solid_color = 0

while True:
    if cp.switch:  # if slide switch is in the "on" position, run animations
        animations.animate()  #play animation sequence
        if cp.button_a:
            animations.next()
            while cp.button_a:
                continue
                                                   speed=0.1,
                                                   colors=rainbow_colors,
                                                   size=2,
                                                   spacing=3)

custom_color_chase_bgp = CustomColorChase(pixels,
                                          speed=0.1,
                                          colors=[BLUE, GREEN, PINK],
                                          size=3,
                                          spacing=2)

# Can use integer values for color, 0 is black
custom_color_chase_br = CustomColorChase(pixels,
                                         speed=0.1,
                                         colors=[BLUE, 0, RED, 0],
                                         size=2,
                                         spacing=0)

animations = AnimationSequence(
    custom_color_chase_rainbow,
    custom_color_chase_rainbow_r,
    custom_color_chase_rainbowchase,
    custom_color_chase_bgp,
    custom_color_chase_br,
    advance_interval=6,
    auto_clear=True,
)

while True:
    animations.animate()
from adafruit_led_animation.color import RED, BLUE

# 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

# Update to matchpin connected to button that connect logic high when pushed
button_pin = board.D3

pixels = neopixel.NeoPixel(pixel_pin,
                           pixel_num,
                           brightness=0.5,
                           auto_write=False)
button = DigitalInOut(button_pin)
button.direction = Direction.INPUT
button.pull = Pull.UP

solid_blue = Solid(pixels, color=BLUE)
solid_red = Solid(pixels, color=RED)
animation_sequence = AnimationSequence(solid_blue, solid_red, auto_clear=True)

while True:
    animation_sequence.animate()

    # Pressing the button pauses the animation permanently
    if not button.value:
        animation_sequence.next()
        while button.value:
            time.sleep(0.1)  # Used for button debouncing
def switch_colors(anim):
    anim.color = colorwheel(random.randint(0, 255))


comet = Comet(pixels,
              speed=0.03,
              color=(0, 255, 255),
              tail_length=6,
              bounce=False)
comet1 = Comet(pixels,
               speed=0.05,
               color=(255, 255, 0),
               tail_length=6,
               bounce=True)
rainbow = Rainbow(pixels, speed=0.1, period=2, step=10)
animations = AnimationSequence(comet, comet1, rainbow, advance_interval=6)

comet.add_cycle_complete_receiver(switch_colors)
comet.notify_cycles = 2

ble = BLERadio()
uart_service = UARTService()
advertisement = ProvideServicesAdvertisement(uart_service)

while True:
    #advertise when not connected
    ble.start_advertising(advertisement)
    while not ble.connected:
        animations.animate()
    ble.stop_advertising()
예제 #24
0
                     colorwheel_offset=50,
                     step=4)
sparkle = Sparkle(pixels, speed=0.1, color=BLUE, num_sparkles=10)
sparkle2 = Sparkle(pixels, speed=0.5, color=PURPLE, num_sparkles=4)
off = Solid(pixels, color=BLACK)

# Animations Playlist - reorder as desired. AnimationGroups play at the same time
animations = AnimationSequence(
    rainbow_comet2,  #
    rainbow_comet,  #
    chase,  #
    rainbow_chase,  #
    rainbow,  #
    AnimationGroup(
        sparkle,
        strum,
    ),
    AnimationGroup(
        sparkle2,
        rainbow_comet3,
    ),
    off,
    auto_clear=True,
    auto_reset=True,
)

MODE = 1
LASTMODE = 1  # start up in sound reactive mode
i = 0
# Are we already advertising?
advertising = False
예제 #25
0
animations = AnimationSequence(
    AnimationGroup(
        fuego,
        fuego2,
        lava,
        sparkle,
    ),
    chase,
    rainbow_chase2,
    rainbow,
    AnimationGroup(
        rainbow_comet,
        sparkle3,
    ),
    AnimationGroup(
        rainbow_comet2,
        sparkle3,
    ),
    AnimationGroup(
        sparkle,
        strum,
    ),
    AnimationGroup(
        sparkle2,
        rainbow_comet3,
    ),
    AnimationGroup(
        black_left,
        black_right,
    ),
    black_left,
    auto_clear=True,
    auto_reset=True,
)
예제 #26
0
                                 brightness=0.5,
                                 auto_write=False)
cp.pixels.brightness = 0.5

animations = AnimationSequence(
    # Synchronized to 0.5 seconds. Ignores the second animation setting of 3 seconds.
    AnimationGroup(
        Blink(cp.pixels, 0.5, color.CYAN),
        Blink(strip_pixels, 3.0, color.AMBER),
        sync=True,
    ),
    # Different speeds
    AnimationGroup(
        Comet(cp.pixels, 0.1, color.MAGENTA, tail_length=5),
        Comet(strip_pixels, 0.01, color.MAGENTA, tail_length=15),
    ),
    # Different animations
    AnimationGroup(
        Blink(cp.pixels, 0.5, color.JADE),
        Comet(strip_pixels, 0.05, color.TEAL, tail_length=15),
    ),
    # Sequential animations on the built-in NeoPixels then the NeoPixel strip
    Chase(cp.pixels, 0.05, size=2, spacing=3, color=color.PURPLE),
    Chase(strip_pixels, 0.05, size=2, spacing=3, color=color.PURPLE),
    advance_interval=3.0,
    auto_clear=True,
    auto_reset=True,
)

while True:
    animations.animate()
예제 #27
0
             tail_length=40,
             bounce=False)
sparkle = Sparkle(pixel_map[4], speed=0.01, color=BLUE, num_sparkles=10)
sparkle2 = Sparkle(pixel_map[1], speed=0.05, color=PURPLE, num_sparkles=4)

# Animations Playlist - reorder as desired. AnimationGroups play at the same time
animations = AnimationSequence(
    rainbow,
    rainbow_chase,
    rainbow_chase2,
    chase,
    lava,
    rainbow_comet,
    rainbow_comet2,
    AnimationGroup(
        sparkle,
        strum,
    ),
    AnimationGroup(
        sparkle2,
        rainbow_comet3,
    ),
    auto_clear=True,
    auto_reset=True,
)

MODE = 0
LASTMODE = 1  # start up in sound reactive mode
i = 0

# Main loop
예제 #28
0
from adafruit_led_animation.animation.rainbowcomet import RainbowComet
from adafruit_led_animation.animation.rainbowsparkle import RainbowSparkle
from adafruit_led_animation.sequence import AnimationSequence

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

rainbow = Rainbow(pixels, speed=0.1, period=2)
rainbow_chase = RainbowChase(pixels, speed=0.1, size=5, spacing=3)
rainbow_comet = RainbowComet(pixels, speed=0.1, tail_length=7, bounce=True)
rainbow_sparkle = RainbowSparkle(pixels, speed=0.1, num_sparkles=15)

animations = AnimationSequence(
    rainbow,
    rainbow_chase,
    rainbow_comet,
    rainbow_sparkle,
    advance_interval=5,
    auto_clear=True,
)

while True:
    animations.animate()
예제 #29
0
# Update to match the pin connected to your NeoPixels
pixel_pin = board.A1
# Update to match the number of NeoPixels you have connected
pixel_num = 64
heart_mask = [
    1, 2, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
    24, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 42, 43, 44, 45, 51,
    52
]

unheart_mask = [
    0, 3, 4, 7, 32, 39, 40, 41, 46, 47, 48, 49, 50, 53, 54, 55, 56, 57, 58, 59,
    60, 61, 62, 63
]

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

animations = AnimationSequence(
    Sparkle(pixels, speed=0.05, color=JADE, num_sparkles=1, mask=unheart_mask),
    Sparkle(pixels, speed=0.05, color=AQUA, num_sparkles=1),
    Sparkle(pixels, speed=0.05, color=PINK, num_sparkles=1, mask=heart_mask),
    advance_interval=5,
    auto_clear=False,
)

while True:
    animations.animate()
예제 #30
0
                spacing=6,
                color=JADE)
rainbow_chase_v = RainbowChase(pixel_wing_vertical,
                               speed=0.1,
                               size=3,
                               spacing=2,
                               step=8)
rainbow_comet_v = RainbowComet(pixel_wing_vertical,
                               speed=0.1,
                               tail_length=7,
                               bounce=True)
rainbow_v = Rainbow(pixel_wing_vertical, speed=0.1, period=2)
rainbow_chase_h = RainbowChase(pixel_wing_horizontal,
                               speed=0.1,
                               size=3,
                               spacing=3)

animations = AnimationSequence(
    rainbow_v,
    comet_h,
    rainbow_comet_v,
    chase_h,
    rainbow_chase_v,
    comet_v,
    rainbow_chase_h,
    advance_interval=5,
)

while True:
    animations.animate()