Skip to content

adding code for Pumpkin Goblin CPB Ornament #1908

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions Pumpkin_Goblin_CPB_Ornament/code.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
# SPDX-License-Identifier: MIT

"""
This example shows different ways to use AnimationGroup: syncing four animations across two separate
pixel objects such as the built-in NeoPixels on a Circuit Playground Bluefruit and a NeoPixel Ring.

This example is written for Circuit Playground Bluefruit and a 16-pixel NeoPixel ring connected to
pad A1. It does not work on Circuit Playground Express.
"""
import board
import neopixel
from adafruit_circuitplayground import cp

from adafruit_led_animation.animation.blink import Blink
from adafruit_led_animation.animation.comet import Comet
from adafruit_led_animation.animation.pulse import Pulse
from adafruit_led_animation.animation.sparkle import Sparkle

from adafruit_led_animation.group import AnimationGroup
from adafruit_led_animation.sequence import AnimationSequence

import adafruit_led_animation.color as color

strip_pixels = neopixel.NeoPixel(board.A1, 16, 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()