1.my code organization is not optimal
2. copper defeciency is affecting how fast the leds can receive instructions because its an array of 103 pixels on 2 separate pins
3. The feather m4 express im using only has 120mhz to work with and too much code firing at once is going to cause "frame" loss from complexity of the code.
I wasnt sure if just making the code sleep for a milisecond would fix this issue or if I need to find a different way to do the same effect
code below
Code: Select all
import board
import neopixel
import time
from adafruit_led_animation.animation.comet import Comet
from adafruit_led_animation.sequence import AnimationSequence
from adafruit_led_animation.color import PURPLE, AMBER, JADE, CYAN, TEAL
from adafruit_led_animation.group import AnimationGroup
from adafruit_led_animation import color
from adafruit_led_animation.animation.sparkle import Sparkle
from adafruit_led_animation import helper
from adafruit_led_animation.helper import PixelMap
from adafruit_led_animation.helper import PixelSubset
# Update to match the pin connected to your NeoPixels
pixel_pin = board.A4
pixel_pinL = board.A2
# Update to match the number of NeoPixels you have connected
pixel_num = 103
pixels = neopixel.NeoPixel(
pixel_pin, pixel_num, brightness=0.5, auto_write=False, pixel_order=(1, 0, 2, 3)
)
pixil = neopixel.NeoPixel(
pixel_pinL, pixel_num, brightness=0.5, auto_write=False, pixel_order=(1, 0, 2, 3)
)
leds_range0 = PixelMap(pixels, range(0, 16), individual_pixels=True) # 0 to J-shape
leds_range1 = PixelMap(pixil, range(0, 17), individual_pixels=True)
crestR = PixelSubset(pixil, 17,29)
stem_R = PixelSubset(pixil, 29,52)
crestL = PixelSubset(pixels, 16,29)
stem_L = PixelSubset(pixels, 29,50)
rem_R = PixelSubset(pixil, 52,103)
rem_L = PixelSubset(pixels, 50, 103)
crestR2 = PixelSubset(pixil, 17,29)
stem_R2 = PixelSubset(pixil, 29,52)
crestL2 = PixelSubset(pixels, 16,29)
stem_L2 = PixelSubset(pixels, 29,50)
rem_R2 = PixelSubset(pixil, 52,103)
rem_L2 = PixelSubset(pixels, 50, 103)
sped = 0.04
#stem_grid_L = PixelMap(pixels, [
# 3(26, 27, 28, 29, 30, 31, 32) ,
#(33, 34, 35, 36, 37, 38, 39, 40 ,41),
#(42, 43, 44, 45, 46, 47, 48),
#(49, 50, 51, 52),
#(53, 54, 55, 56 ,57) ], individual_pixels=True)
#doesnt work, lights up entire strips at a time
animations = AnimationSequence(
AnimationGroup(
Comet(leds_range0, sped, tail_length=8, color=TEAL),
Comet(leds_range1, sped, tail_length=8, color=TEAL),
Comet(crestR, sped, tail_length=5, color=TEAL),
Comet(stem_R, sped, tail_length=5, color=TEAL),
Comet(crestL, sped, tail_length=5, color=TEAL),
Comet(rem_R, sped, tail_length=15, color=TEAL),
Comet(rem_L, sped, tail_length=15, color=TEAL),
),
AnimationGroup(
Comet(pixels, speed=0.08, color=CYAN),
Comet(pixil, speed=0.08, color=CYAN),
# sync=True,
Sparkle(pixels, speed=0.08, color=TEAL, num_sparkles=10),
Sparkle(pixil, speed=0.08, color=CYAN, num_sparkles=10),
),
advance_interval=8.0,
auto_clear=True,
auto_reset=True,
)
while True:
animations.animate()