Hi,
I am building a music visualizer for my synth-setup. Basically I can get where I want to go, but I have a basic understanding problem. I have been researching for days, but I think I am basically on the wrong track. I would be extremely happy to get some input...
I use 3 WS2812 LED strips connected to pins 3, 5 and 6 of my Arduino UNO.
Please have a look at the attached schematic diagram to see how the LED strips are connected.
The reason why I split and connect the strips this way is because it needs so few cables, it is very tidy and I have to disconnect few connectors when I transport the boxes.
I experimented for days with the Multiple Controller Examples.
Finally I decided to use a single LED array for all LEDS. So I can control the Music Visualizer with the FastLED fill_gradient function. In my final project I have a fill_gradient on each "part" where I can define color and animation direction. Then I control the placement and animation by moving the start and end point of the fill_gradient function. This works like a charm.
Now I want to run a fill_gradient over the whole top (or middle) line for serval Songs (Strip1 Part1 to Strip2 Part1 to Strip3 Part1).
Here is a reduced version of my code to visualize the problem. I have visualized the movement with an i++. A video with the current state is attached. Now the LEDs run over the "Vertical Sections" (see schematic drawing). But I want to let them run over the "Horizontal Sections", one after another. And this without changing the cabling...
#include <FastLED.h>
#define NUM_STRIPS 3
#define NUM_LEDS_PER_STRIP 81
#define NUM_LEDS_PER_PART 27
#define NUM_PARTS 8
#define NUM_LEDS NUM_LEDS_PER_PART * NUM_PARTS
#define BRIGHTNESS 255
#define LED_TYPE WS2812
#define COLOR_ORDER GRB
CRGB leds[NUM_STRIPS * NUM_LEDS_PER_STRIP];
void setup() {
// LED LIGHTING SETUP
FastLED.addLeds<LED_TYPE, 3, COLOR_ORDER>(leds, NUM_LEDS_PER_PART * 0, NUM_LEDS_PER_PART * 3);
FastLED.addLeds<LED_TYPE, 5, COLOR_ORDER>(leds, NUM_LEDS_PER_PART * 3, NUM_LEDS_PER_PART * 2);
FastLED.addLeds<LED_TYPE, 6, COLOR_ORDER>(leds, NUM_LEDS_PER_PART * 5, NUM_LEDS_PER_PART * 3);
}
void loop() {
for (int i = 0; i < NUM_LEDS; i++) {
fill_gradient(leds, 0, CHSV(0, 255, 255), i, CHSV(160, 255, 255));
FastLED.show();
fadeToBlackBy( leds, NUM_LEDS, 255);
delay(10);
}
}
As I understand the problem it would be a rearrangement of the LEDs in the array. One of many failed attempts was the following. It works for the first horizontal section, but when I uncomment the other Lines the second and third horizontal section in the void setup(), then the pins seems to overwrite themselfs...
#include <FastLED.h>
#define NUM_STRIPS 3
#define NUM_LEDS_PER_STRIP 81
#define NUM_LEDS_PER_PART 27
#define NUM_PARTS 8
#define NUM_LEDS NUM_LEDS_PER_PART * NUM_PARTS
#define BRIGHTNESS 255
#define LED_TYPE WS2812
#define COLOR_ORDER GRB
CRGB leds[NUM_STRIPS * NUM_LEDS_PER_STRIP];
void setup() {
// LED LIGHTING SETUP
FastLED.addLeds<LED_TYPE, 3, COLOR_ORDER>(leds, NUM_LEDS_PER_PART * 0, NUM_LEDS_PER_PART);
FastLED.addLeds<LED_TYPE, 5, COLOR_ORDER>(leds, NUM_LEDS_PER_PART * 1, NUM_LEDS_PER_PART);
FastLED.addLeds<LED_TYPE, 6, COLOR_ORDER>(leds, NUM_LEDS_PER_PART * 2, NUM_LEDS_PER_PART);
// FastLED.addLeds<LED_TYPE, 3, COLOR_ORDER>(leds, NUM_LEDS_PER_PART * 3, NUM_LEDS_PER_PART);
// FastLED.addLeds<LED_TYPE, 5, COLOR_ORDER>(leds, NUM_LEDS_PER_PART * 4, NUM_LEDS_PER_PART);
// FastLED.addLeds<LED_TYPE, 6, COLOR_ORDER>(leds, NUM_LEDS_PER_PART * 5, NUM_LEDS_PER_PART);
// FastLED.addLeds<LED_TYPE, 3, COLOR_ORDER>(leds, NUM_LEDS_PER_PART * 6, NUM_LEDS_PER_PART);
// FastLED.addLeds<LED_TYPE, 6, COLOR_ORDER>(leds, NUM_LEDS_PER_PART * 7, NUM_LEDS_PER_PART);
}
void loop() {
for (int i = 0; i < NUM_LEDS; i++) {
fill_gradient(leds, 0, CHSV(0, 255, 255), i, CHSV(160, 255, 255));
FastLED.show();
fadeToBlackBy( leds, NUM_LEDS, 255);
delay(10);
}
}
I hope I have clearly described the problem and am very happy about any input.
Thank you very much and greetings JPTHA