hey, (sorry for the weird questions!)
does
struct CRGB sideLeds[NUM_LEDS_IN_SEGMENT * NUM_SIDES];
operate like
int sideLeds[NUM_LEDS_IN_SEGMENT * NUM_SIDES]?
im trying to create a 1D array from a 2D array, and it works if i have the 2D array, convert to 1D array, but if i try to assign to the 1D CRGB array i get weird results.
the following code should initialize the crgb array, assign the 1st value in the crgb array with the 1st number in the 2d array and then print the number, this should return the number 4, as it is the 1st number in the 2d array [0][0], but it returns the number 1.
#include <FastLED.h> #define NUM_LEDS_IN_SEGMENT 2 #define NUM_SIDES 4 #define NUM_LEDS 12 #define DATA_PIN 3 #define CLOCK_PIN 13 #define BRIGHTNESS 255 struct CRGB sideLeds[NUM_LEDS_IN_SEGMENT * NUM_SIDES]; byte sideState[6][4] = { {4, 6, 2, 5}, // 1 0,1 {5, 1, 6, 3}, // 2 2,3 {5, 2, 6, 4}, // 3 4,5 {3, 6, 1, 5}, // 4 6,7 {4, 1, 2, 3}, // 5 8,9 {3, 2, 1, 4} // 6 10,11 }; int state = 1; void setup() { // put your setup code here, to run once: Serial.begin(9600); // start serial for output // FastLED.addLeds<LPD8806, DATA_PIN, CLOCK_PIN, BRG>(leds, NUM_LEDS); FastLED.addLeds<LPD8806, DATA_PIN, CLOCK_PIN, BRG>(sideLeds, NUM_LEDS_IN_SEGMENT*NUM_SIDES); FastLED.clear(); FastLED.setBrightness(BRIGHTNESS); } void loop() { sideLeds[0] = (sideState[0][0]); Serial.print(sideLeds[0]); // 4 6 2 5 // 6,7 10,11 2,3 8,9 }