hey, (sorry for the weird questions!) does  struct CRGB sideLeds[NUM_LEDS_IN_SEGMENT * NUM_SIDES];

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 }

Well, from the pastebin code, you are assigning a single value from a 2d array of shorts to a CRGB object which cannot be assigned a short (I don’t think anyway). CRGB is a container object, and what you’re doing doesn’t make a lot of sense.

Is sideState an index to something, or is it supposed to represent a color?

Hey! Sidestate is the acquired value from an accelerometer. Whichever side of a cube is pointing up decides on the state.

What I’m trying to do is the sides of the cube light up, or more so, get the individual addresses of the sides into a crbg so patterns can be created more easily.

I thought I could access the leds directly like this, and I think I can set up multiple strings in the setup section (which for the moment would be just 6 sides) if I can find a way to automate the selection process.

I’ll look into the crgb container thing as this feels like the simplest way :?

OK, so I think your mistake is that you want sideState as the index, not the value assigned.

It probably should be something like

sideLeds[sideState[x][y]] = CRGB::Color;

That does the correct assignment, and uses sideState as the index into the array to set a color for a specific led.