Hi!
So I am having some issues with wrapping my head around what could potentially be a relatively simple problem to fix and was looking for some guidance.
What am I trying to accomplish?
I have a 144LED/m strip that I would like to create a rainbow pattern on, EXCEPT that instead of filling the whole strip from led 0 to 143, I need it to fill the first half of the strip and then be mirrored over to the 2nd half of the strip. This is so that it looks like the colours are "spawning" in the middle of the strip and moving out towards the ends.
I have successfully managed to fill only the first half of the strip (leds 0 - 71) with my moving rainbow pattern but now I have no idea how to copy/mirror this over to the 2nd half of the strip (leds 72-143).
Unfortunately I cant just wire the 2 halves of the strip form the middle on the same data pin as this is only one of many effects that I will have stored and accessed by a bluetooth app. Not all of the patterns require it to be mirrored from the centre of the strip.
Here are some details about the project:
Board Type: ESP32 (Node MCU ESP-32s v11.10)
LED Type: WS2812B
Total LED Count: 144 (on a 1m strip)
And here is my current code.
#include "FastLED.h"
#define DATA_PIN 2
#define LED_TYPE WS2812B
#define COLOR_ORDER GRB
#define NUM_LEDS 144 // Total number of pixels in strip
#define BRIGHTNESS 128
CRGB leds[NUM_LEDS];
//---------------------------------------------------------------
void setup() {
FastLED.addLeds<LED_TYPE,DATA_PIN,COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
FastLED.setBrightness(BRIGHTNESS);
FastLED.clear();
FastLED.show();
}
//---------------------------------------------------------------
void loop()
{
Rainbow_halfStrip(); // draw Rainbow data to half strip
FastLED.show(); // display leds
delay(100);
}
uint8_t hue = 0;
void Rainbow_halfStrip() {
for (int i = 0; i < NUM_LEDS/2; i++) {
leds[i] = CHSV(hue + (i* 1), 255, 55);
}
EVERY_N_MILLISECONDS(100){
hue++;
}
}
Is what I have so far going down the wrong path?
If any anyone could steer me in the right direction or has any useful links with how to go about achieving this "rainbow form the centre of the strip" look that im after it would be greatly appreciated as I really am stuck with this one.
Thanks in advance!