(31, 52, AMBER),
    (53, 72, YELLOW),
    (77, 96, GREEN),
    (98, 119, TEAL),
    (120, 145, BLUE),
    (150, 173, PURPLE),
    (180, 200, MAGENTA),
)

# 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():
示例#2
0
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])

animations = AnimationSequence(
    comet,
    blink,
    rainbow_sparkle,
    chase,
    pulse,
    sparkle,
    rainbow,
示例#3
0
input_floor = normalized_rms(samples) + 30
# OR: used a fixed floor
# input_floor = 50

# You might want to print the input_floor to help adjust other values.
print(input_floor)

# Corresponds to sensitivity: lower means more pixels light up with lower sound
# Adjust this as you see fit.
input_ceiling = input_floor + 100

peak = 0

# Cusomize LED Animations  ------------------------------------------------------
rainbow = Rainbow(pixels, speed=0, period=6, name="rainbow", step=2.4)
rainbow_chase = RainbowChase(pixels, speed=0.1, size=5, spacing=5, step=5)
chase = Chase(pixels, speed=0.2, color=ORANGE, size=2, spacing=6)
rainbow_comet = RainbowComet(pixels, speed=0.1, tail_length=30, bounce=True)
rainbow_comet2 = RainbowComet(
    pixels, speed=0.1, tail_length=104, colorwheel_offset=80, bounce=True
    )
rainbow_comet3 = RainbowComet(
    pixels, speed=0, tail_length=25, colorwheel_offset=80, step=4, bounce=False
    )
strum = RainbowComet(
    pixels, speed=0.1, tail_length=25, bounce=False, 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)
示例#4
0
pixel_width = 8
pixel_height = 8
num_pixels = pixel_width * pixel_height
pixels = adafruit_dotstar.DotStar(board.A1,
                                  board.A2,
                                  num_pixels,
                                  auto_write=False,
                                  brightness=0.1)
pixel_framebuf = PixelFramebuffer(pixels,
                                  pixel_width,
                                  pixel_height,
                                  rotation=1,
                                  alternating=False,
                                  reverse_x=True)
# Fancy animations from https://learn.adafruit.com/circuitpython-led-animations
rainbow_chase = RainbowChase(pixels, speed=0.1, size=3, spacing=6, step=8)
chase = Chase(pixels, speed=0.1, color=CYAN, size=3, spacing=6)
rainbow_comet = RainbowComet(pixels,
                             speed=0.1,
                             tail_length=5,
                             bounce=True,
                             colorwheel_offset=170)


def scroll_framebuf_neg_x(word, color, shift_x, shift_y):
    pixel_framebuf.fill(0)
    color_int = int('0x%02x%02x%02x' % color, 16)

    # negate x so that the word can be shown from left to right
    pixel_framebuf.text(word, -shift_x, shift_y, color_int)
    pixel_framebuf.display()
示例#5
0
                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,
                size=3,
                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,
示例#6
0
        pixels.show()
        time.sleep(0.005)
        pixels.fill(TILT_COLOR)
        pixels.show()
        time.sleep(0.01)
        pixels.fill(BLACK)
        pixels.show()
        time.sleep(0.03)


# Cusomize LED Animations  ------------------------------------------------------
powerup = RainbowComet(pixel_map[3], speed=0, tail_length=25, bounce=False)
rainbow = Rainbow(pixel_map[4], speed=0, period=6, name="rainbow", step=2.4)
rainbow_chase = RainbowChase(pixel_map[3],
                             speed=0,
                             size=3,
                             spacing=15,
                             step=10)
rainbow_chase2 = RainbowChase(pixel_map[2],
                              speed=0,
                              size=10,
                              spacing=1,
                              step=18)
chase = Chase(pixel_map[1], speed=0.1, color=RED, size=1, spacing=6)
rainbow_comet = RainbowComet(pixel_map[2],
                             speed=0,
                             tail_length=80,
                             bounce=True)
rainbow_comet2 = RainbowComet(pixel_map[0],
                              speed=0,
                              tail_length=104,
def power_on(duration):
    """
    Animate NeoPixels for power on.
    """
    start_time = time.monotonic()  # Save start time
    while True:
        elapsed = time.monotonic() - start_time  # Time spent
        if elapsed > duration:  # Past duration?
            break  # Stop animating
        powerup.animate()


# Cusomize LED Animations  ------------------------------------------------------
powerup = RainbowComet(pixel_map[3], speed=0, tail_length=25, bounce=False)
rainbow = Rainbow(pixel_map[2], speed=0, period=6, name="rainbow", step=2.4)
rainbow_chase = RainbowChase(pixels, speed=0, size=6, spacing=15, step=10)
rainbow_chase2 = RainbowChase(pixels,
                              speed=0,
                              size=10,
                              spacing=1,
                              step=18,
                              name="rainbow_chase2")
chase = RainbowChase(pixel_map[3], speed=0, size=20, spacing=20)
chase2 = Chase(pixels, speed=0.1, color=ORANGE, size=6, spacing=6)
rainbow_comet = RainbowComet(pixel_map[2],
                             speed=0,
                             tail_length=200,
                             bounce=True)
rainbow_comet2 = RainbowComet(pixels,
                              speed=0,
                              tail_length=104,