Skip to content

Help with Animating a virtual CRGBArray #7

Open

Description

@mozzhead164

Hi, Nice work on the library!

I need help with setting up a custom array of LEDs

I have set up an XY matrix with a lookup table for my LEDs XY positions.
When i run MatrixExample1 using;
leds.SetLEDArray(&leds_real[0]); in setup,
which compiles and runs fine but is not mapped to my custom XY map layout,

I have tried setting up a virtual CRGBArray and then using
leds.SetLEDArray(&leds_virt[0]);

to map the matrix/sprites to a this array first, and then map that virtual to my 'real' LEDs using;

for (int y = 0; y < kMatrixHeight - 1; y++) {
for (int x = 0; x < kMatrixWidth; x++) {
uint16_t XYPos = suitLookUpTable[ (y * kMatrixWidth) + x];
if(XYPos > 0) { leds_real[XYPos-1] = leds_virt(x,y); }
}
}

But can't seem to get it working...
Is there anything obvious im missing here?
Should I SetLEDArray to my real LEDs and do the LookUpTable somewhere else?

Many Thanks for your time mate, really appreciate it.

Activity

  1. AaronLiddiment commented on Oct 7, 2017

    @AaronLiddiment
    Owner

    Why do you need to use a look up table?
    Is your matrix not a full XY one or does it have a strange shape/holes?
    If this is the case then I would declare another array of CRGB's that you use with the Fastled calls and is your live array, then after using my routines, run your lookup routine to transfer the CRGB's from my Matrix array to your actual Fastled one.

  2. mozzhead164 commented on Oct 7, 2017

    @mozzhead164
    Author

    Well, my project is a Flyboard Suit for a friend so my LEDs are stitched into a wetsuit.
    https://www.youtube.com/watch?v=E5uf7tjy0NI
    You can see the arrangement has requirements of its own :) its took me a while put it that way

    It would be sick to have some sprites and text flying across while he's in the air.

    I'm gonna see what i can get done tonight, just thought there was a better way to set up my LEDs (pointers maybe?) so that i didn't have to waste cycles in a for loop iterating one array into another.

    Cheers Aaron

  3. AaronLiddiment commented on Oct 8, 2017

    @AaronLiddiment
    Owner

    I presume you just have an 'int' array that translates from an X/Y to your actual LED with say 0's or -1 for LED's that don't exist?
    If so then you could just modify the mXY() function to return the translated LED number.
    You could an an extra CRGB to the end of the LED array and return this index when the LED does no exist on your suit.

    I did do a mask version of the library that allowed you to pass a bit mask of the valid leds in the matrix. So you could have irregular cutouts but the leds still had to be wired in sequence of the X/Y matrix but could have holes where leds were missed out. I never posted it though as I wasn't happy with the code/method and ended up surpassing it with the multiple matrix version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions