Skip to content

Commit 1b3b84d

Browse files
committed
adding code for Pumpkin Goblin CPB Ornament
adding code for Pumpkin Goblin CPB Ornament
1 parent 66869a0 commit 1b3b84d

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

Pumpkin_Goblin_CPB_Ornament/code.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
2+
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
3+
# SPDX-License-Identifier: MIT
4+
5+
"""
6+
This example shows different ways to use AnimationGroup: syncing four animations across two separate
7+
pixel objects such as the built-in NeoPixels on a Circuit Playground Bluefruit and a 16x NeoPixel Ring.
8+
9+
This example is written for Circuit Playground Bluefruit and a 16-pixel NeoPixel ring connected to
10+
pad A1. It does not work on Circuit Playground Express.
11+
"""
12+
import board
13+
import neopixel
14+
from adafruit_circuitplayground import cp
15+
16+
from adafruit_led_animation.animation.blink import Blink
17+
from adafruit_led_animation.animation.comet import Comet
18+
from adafruit_led_animation.animation.chase import Chase
19+
from adafruit_led_animation.animation.pulse import Pulse
20+
from adafruit_led_animation.animation.sparkle import Sparkle
21+
22+
from adafruit_led_animation.group import AnimationGroup
23+
from adafruit_led_animation.sequence import AnimationSequence
24+
25+
import adafruit_led_animation.color as color
26+
27+
strip_pixels = neopixel.NeoPixel(board.A1, 16, brightness=0.5, auto_write=False)
28+
cp.pixels.brightness = 0.5
29+
30+
animations = AnimationSequence(
31+
# Synchronized to 0.5 seconds. Ignores the second animation setting of 3 seconds.
32+
AnimationGroup(
33+
Sparkle(cp.pixels, 0.1, color.GREEN, num_sparkles=1),
34+
Sparkle(strip_pixels, 0.1, color.GREEN, num_sparkles=1),
35+
),
36+
AnimationGroup(
37+
Blink(cp.pixels, 0.25, color.RED),
38+
Blink(strip_pixels, 0.25, color.RED),
39+
sync=True,
40+
),
41+
# Different speeds
42+
AnimationGroup(
43+
Comet(cp.pixels, 0.05, color.GREEN, tail_length=5),
44+
Comet(strip_pixels, 0.05, color.GREEN, tail_length=5),
45+
),
46+
AnimationGroup(
47+
Pulse(cp.pixels, 0.05, color.RED, period=3),
48+
Pulse(strip_pixels, 0.05, color.RED, period=3),
49+
),
50+
advance_interval=4.0,
51+
auto_clear=True,
52+
auto_reset=True,
53+
)
54+
55+
while True:
56+
animations.animate()

0 commit comments

Comments
 (0)