strip mirroring! 2 strips of 16 leds, put on pins 3 and 4,

strip mirroring!

2 strips of 16 leds, put on pins 3 and 4, using the;
CRGB ledsA[NUM_LEDS_PER_STRIPA];
CRGB ledsB[NUM_LEDS_PER_STRIPB];

FastLED.addLeds<WS2812B, DATA_PINA, GRB>(ledsA, 0, NUM_LEDS_PER_STRIPA); FastLED.addLeds<WS2812B, DATA_PINB, GRB>(ledsB, 0, NUM_LEDS_PER_STRIPB);

and a tweaky pattern;

void rotatingDots (int speed1, int hue1, int speed2, int hue2, int speed3, int hue3, int fadeSpeed) {
ledsA[pos1] += CHSV(hue1, 255, 255);
ledsA[pos2] += CHSV(hue2, 255, 255);
ledsA[pos3] += CHSV(hue3, 255, 255);

ledsB[pos1] = ledsA[pos1];
ledsB[pos2] = ledsA[pos2];
ledsB[pos3] = ledsA[pos3];

EVERY_N_MILLISECONDS (10) {
pos1=map(sin8(millis()/speed1), 0, 255, 0, NUM_LEDSA);
pos2=map(sin8(millis()/speed2), 0, 255, 0, NUM_LEDSA);
pos3=map(sin8(millis()/speed3), 0, 255, 0, NUM_LEDSA);
fade=fadeSpeed;
}
}

now this works beautifully for the 2 strips showing the same pattern, but some of the patterns i would like to be synced (as above) and then a choice to mirror them.

now ive given changing the array around, but it seems to just not work;

int mirrorLeds[16] = {15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0};

void mirrorMe() {
if ( MIRROR == 1 ) { for (int i=0; i<16; i++) { ledsB[i] = mirrorLeds[i];
} else {
for (int i=0; i<16; i++) { ledsB[i] = [i]; }
}
}
} // end of void mirrorMe

the theory being that i can remap the address’s on the fly.

oo… am i better constructing a CRGB that is 32 leds long, and then remapping [0 - 32] and then [0-16 > 32- 17] and running from one pin?

What’s up with this line?

for (int i=0; i<16; i++) { ledsB[i] = [i]; }

and what’s mirrorLeds? (and I think that putting the whole .ino up in a gist would make reading it a lot easier :slight_smile:

fixed it!

instead of deleting the post, i’m showing my results. i know you guys are super more c++ than i am, so this is for the newers! :slight_smile:

using;
CRGB ledsA[NUM_LEDS_PER_STRIPA];
CRGB ledsB[NUM_LEDS_PER_STRIPB];

int forwardLeds[16] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
int mirrorLeds[16] = {15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
int currentLeds[16];

and then;

for (int i=0; i<16; i++) {
currentLeds[i] = mirrorLeds[i];
}

and then;

void rotatingDots (int speed1, int hue1, int speed2, int hue2, int speed3, int hue3, int fadeSpeed) {
animating=1;
ledsA[pos1] += CHSV(hue1, 255, 255);
ledsA[pos2] += CHSV(hue2, 255, 255);
ledsA[pos3] += CHSV(hue3, 255, 255);

ledsB[currentLeds[pos1]] = ledsA[pos1];
ledsB[currentLeds[pos2]] = ledsA[pos2];
ledsB[currentLeds[pos3]] = ledsA[pos3];

EVERY_N_MILLISECONDS (10) {
pos1=map(sin8(millis()/speed1), 0, 255, 0, NUM_LEDSA);
pos2=map(sin8(millis()/speed2), 0, 255, 0, NUM_LEDSA);
pos3=map(sin8(millis()/speed3), 0, 255, 0, NUM_LEDSA);
fade=fadeSpeed;
}
}

all is good!

@Daniel_Garcia

the way i had that worked out was;

for mirroring;
mirrorleds [16, 15, 14, 13, 12, 11, 10, 9, 8 etc… = i
leds[i] = mirrorleds[i] >> leds[0] = mirrorleds[16], leds[1] = mirrorleds[15]
and then in reverse
leds[0] = [0], leds[1] = [1]

but i think what you’re pointing out is that i shoudnt have had the [i] so it should have read for (int i=0; i<16; i++) { ledsB[i] = i; }

I’ve been wanting to get around to doing something similar with two strips of leds and was wondering if something as simple as using one data pin to control two strips at the same time. This seems like a low tech way of providing a mirroring solution while reducing the memory requirements by 1/2. I’m wondering if anybody has any actual experience with this and could offer any advice.

@Kelly_Sumrall it works, I know that. And in perfect sync. I’m not sure if it’s a good idea or not, and my strips have only been 30/60 long ish. You might encounter issues when it’s trying to push more data along

@Kelly_Sumrall and that’s more like sync, as opposed to mirror