Skip to content

Instantly share code, notes, and snippets.

@FoamyGuy
Created June 23, 2020 23:43
Show Gist options
  • Save FoamyGuy/bd5a4dedcf5d41f4f17e5214d8d879b2 to your computer and use it in GitHub Desktop.
Save FoamyGuy/bd5a4dedcf5d41f4f17e5214d8d879b2 to your computer and use it in GitHub Desktop.
import board
import neopixel
from adafruit_led_animation.animation.comet import Comet
from adafruit_led_animation.color import GREEN, RED, BLUE, PURPLE
from adafruit_led_animation.group import AnimationGroup
from adafruit_led_animation import helper
# Update to match the pin connected to your NeoPixels
pixel_pin = board.NEOPIXEL
# Update to match the number of NeoPixels you have connected
pixel_num = 32
pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=0.1, auto_write=False)
first_row = helper.PixelSubset(pixels, 0, 8)
second_row = helper.PixelSubset(pixels, 8, 16)
third_row = helper.PixelSubset(pixels, 16, 24)
fourth_row = helper.PixelSubset(pixels, 24, 32)
comet = Comet(first_row, speed=0.05, color=RED, tail_length=4, bounce=True)
comet2 = Comet(second_row, speed=0.05, color=GREEN, tail_length=4)
comet3 = Comet(third_row, speed=0.05, color=BLUE, tail_length=4, bounce=True)
comet4 = Comet(fourth_row, speed=0.05, color=PURPLE, tail_length=4)
group = AnimationGroup(comet,comet2, comet3, comet4)
while True:
group.animate()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment