I have a small test program to lite up my two strips of Dotstars with are 72 pixels each (divided up in to group of 6 and spaced 12" apart). I've created and array to divide up the strips in to 6 pixel segments so that each strip has essentially 12 addressable groups.
Everything works correctly in that I've tested each of the strings individually in a loop, but when I try to create a test loop to turn them on and off sucessively, it Lights the first strips and then proceeds to the second string Leds[1] and only lights up the first group of 6 on that string.
I don't think this is a FastLED or Dotstar issue but more of a basic logic programming issue. I know this because the serial monitor print the first "if" condition ( leds[0] ) 12 times. It then enters the "else if" Leds[1] and prints the serial statement just once and then the program halts ( i.e. no more serial print statements and assume the main loop is halted?)
What am I missing here?
and here is my code
// Simple strand test for Adafruit Dot Star using FastLED
#include <FastLED.h>
#include <SPI.h> // COMMENT OUT THIS LINE FOR GEMMA OR TRINKET
int32_t speed = 100;
int brightness = 80;
int seq_count = 0;
#define DATAPIN1 5
#define CLOCKPIN1 11
#define DATAPIN2 12 // to add second string eventually
#define CLOCKPIN2 2
#define NUM_STRIPS 2
#define NUM_LEDS_PER_STRIP 72
CRGB leds[NUM_STRIPS][NUM_LEDS_PER_STRIP];
/*
leds0 (leds(0, 5);
leds1 (leds(6, 11);
leds2 (leds(12, 17);
leds3 (leds(18, 23);
leds4 (leds(24, 29);
leds5 (leds(30, 35);
leds6 (leds(36, 41);
leds7 (leds(42, 47);
leds8 (leds(48, 53);
leds9 (leds(54, 59);
leds10 (leds(60, 65);
leds11 (leds(66, 71);
leds12 (leds(72, 77);
leds13 (leds(78, 83);
leds14 (leds(84, 89);
leds15 (leds(90, 95);
leds16 (leds(96, 101);
leds17 (leds(102, 107);
leds18 (leds(108, 113);
leds19 (leds(114, 119);
leds20 (leds(120, 125);
leds21 (leds(126, 131);
leds22 (leds(132, 137);
leds23 (leds(138, 144);
*/
//CRGB leds[NUM_LEDS];
int ledsarray[24] = { 0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72, 78, 84, 90, 96, 102, 108, 114, 120, 126, 132, 138 };
void setup() {
Serial.begin(115200);
delay(1000);
FastLED.addLeds<DOTSTAR, DATAPIN1, CLOCKPIN1 >(leds[0], NUM_LEDS_PER_STRIP);
FastLED.addLeds<DOTSTAR, DATAPIN2, CLOCKPIN2 >(leds[1], NUM_LEDS_PER_STRIP);
FastLED.setBrightness(brightness);
FastLED.clear();
FastLED.show();
delay(1000);
}
void loop() {
for (int x = 0; x < 24; x++) {
if (x <= 12) {
fill_solid(&(leds[0][ledsarray[x]]), 6, CRGB(255, 255, 255));
Serial.println(" first group of twelve loop is entered to turn ON ");
}
else if (x > 12 ) {
fill_solid(&(leds[1][ledsarray[x]]), 6, CRGB(255, 255, 255));
Serial.println(" second group of twelve loop is entered to turn ON ");
}
FastLED.show();
delay(speed);
}
delay(1000);
for (int x = 0; x < 24; x++) {
Serial.println(" entering the turn OFF loop");
if (x < 12) {
fill_solid(&(leds[0][ledsarray[x]]), 6, CRGB(0, 0, 0));
Serial.println(" first group of twelve loop is entered to turn OFF ");
}
else if (x >= 12 ) {
fill_solid(&(leds[1][ledsarray[x]]), 6, CRGB(0, 0, 0));
Serial.println(" second group of twelve loop is entered to turn OFF");
}
FastLED.show();
delay(speed);
}
/*
// alternate method does not work correctly either =================================
for (int x = 0; x < 12; x++) {
fill_solid(&(leds[0][ledsarray[x]]), 6, CRGB(255, 255, 255));
FastLED.show();
delay(speed);
}
delay(1000);
for (int x = 0; x < 12; x++) {
fill_solid(&(leds[0][ledsarray[x]]), 6, CRGB(0, 0, 0));
FastLED.show();
delay(speed);
}
FastLED.clear();
FastLED.show();
delay(500);
for (int x = 12; x < 24; x++) {
fill_solid(&(leds[1][ledsarray[x]]), 6, CRGB(255, 255, 255));
FastLED.show();
delay(speed);
}
delay(1000);
for (int x = 12; x < 24; x++) {
fill_solid(&(leds[1][ledsarray[x]]), 6, CRGB(0, 0, 0));
FastLED.show();
delay(speed);
}
*/
delay(2000);
}