Skip to content

Commit 6bad204

Browse files
committed
neopixel ring lamp code
neopixel ring lamp code
1 parent f878fdd commit 6bad204

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

NeoPixel_Rings_Lamp/code.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# SPDX-FileCopyrightText: 2021 Ruiz Brothers for Adafruit Industries
2+
# SPDX-License-Identifier: MIT
3+
4+
import time
5+
import board
6+
import neopixel
7+
from adafruit_led_animation.animation.pulse import Pulse
8+
from adafruit_led_animation.animation.rainbow import Rainbow
9+
from adafruit_led_animation.animation.rainbowsparkle import RainbowSparkle
10+
from adafruit_led_animation.animation.rainbowcomet import RainbowComet
11+
from adafruit_led_animation.sequence import AnimationSequence
12+
from adafruit_led_animation.color import RED, PURPLE, AMBER, JADE
13+
from _pixelbuf import colorwheel
14+
15+
# Update this to match the number of NeoPixel LEDs connected to your board.
16+
num_pixels = 124
17+
18+
pixels = neopixel.NeoPixel(board.GP1, num_pixels, auto_write=True)
19+
pixels.brightness = 0.2
20+
21+
rainbow = Rainbow(pixels, speed=0.01, period=1)
22+
rainbow_sparkle = RainbowSparkle(pixels, speed=0.05, num_sparkles=15)
23+
rainbow_comet = RainbowComet(pixels, speed=.01, tail_length=20, bounce=True)
24+
pulse = Pulse(pixels, speed=.05, color=PURPLE, period=3)
25+
26+
animations = AnimationSequence(
27+
pulse, rainbow_sparkle, rainbow_comet, rainbow, advance_interval=5, auto_clear=True, random_order=False
28+
)
29+
30+
while True:
31+
animations.animate()

0 commit comments

Comments
 (0)