Hello,
I am in the process of creating a sword full of neopixel LEDs with some intricate patterns of lights. I currently have it set up to run adafruit led animation comet and sparkle animations but I seem to have run into a wall.
Some parts of my LEDs are side by side to each other and if they are wired in series (strip to strip) it will not give the effect of the lights running straight up the blade at once. I was wondering if it's possible for the sections of my LEDs to run the same animation but as a pixel map so all LEDs horizontally next to each other play the animation before switching out of the pixel map to be displayed in series again. I have RGBW neopixels. Here is a link to visualize what I mean. I would prefer not to solder the data cables for all the horizontal strips together if possible. https://drive.google.com/file/d/1A2qJjM ... p=drivesdk
Circuitpython neopxels animation questions
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- neradoc
- Posts: 542
- Joined: Wed Apr 27, 2016 2:38 pm
Re: Circuitpython neopxels animation questions
It might take tinkering a bit with the parameters, but you could do it in at least two ways.
One would be to setup the pixels as two lines of a 2-by-N array, and run the animation on it, since it's a linear animation each line of the "array" will be identical, meaning each side of the sword will be identical.
Another method would be to define each pair of pixels as being a single pixel in the pixel map.
Here is both (tested on the 10 built-in neopixels on the Circuit Playground Bluefruit)
One would be to setup the pixels as two lines of a 2-by-N array, and run the animation on it, since it's a linear animation each line of the "array" will be identical, meaning each side of the sword will be identical.
Another method would be to define each pair of pixels as being a single pixel in the pixel map.
Here is both (tested on the 10 built-in neopixels on the Circuit Playground Bluefruit)
Code: Select all
NPIXELS = 10
SWORD_LENGTH = NPIXELS // 2
mapped = helper.PixelMap.horizontal_lines(
pixels, 2, SWORD_LENGTH, helper.vertical_strip_gridmap(SWORD_LENGTH, alternating=True)
)
mapped = helper.PixelMap(
pixels, [(x,NPIXELS - 1 - x) for x in range(SWORD_LENGTH)], individual_pixels=True
)
comet = Comet(mapped, speed=0.02, color=JADE, tail_length=10, bounce=True)
while True:
comet.animate()
- Draculen
- Posts: 72
- Joined: Mon Jan 24, 2022 11:14 pm
Re: Circuitpython neopxels animation questions
This is fantastic! I am still rigging up the LED's now ( I did try to have the Data leads all spliced together to just hardwire them to play simultaneously but the pixels did not seem to respond via that route) Once I have them set up a little further I am really looking forward to trying your suggestion out. Thank you for the reply!
Please be positive and constructive with your questions and comments.