Assembling arrays into ... non-arrays? *lost* ^^"

Hello :),

I am trying to make my code assemble arrays into a single "chunk" (yes I said chunk, that's how much of a newbie I am) but I keep on failing, so if anyone could be nice enough to give me a few hints it would make my day :slight_smile:

void Order_LED(int LEDnum,int LEDlum){ //input the LED strip that you are trying to control, then the desired luminosity level


unsigned long Identity = 1337 + LEDnum; // Each 12V LED strip controller is given a number - which makes up it's "identity" when added to 1337.



//I'm turning the luminosity percentage into "binary"
//Hundreds
unsigned long Hundreds = 0;
if(LEDlum == 100){Hundreds = 1; LEDlum = 0;}

//Dozens
unsigned long Dozens = 0;
while(LEDlum >= 10){Dozens ++; LEDlum = LEDlum - 10;}

//Units
unsigned long Units = 0;
while(LEDlum > 0){Units ++; LEDlum --;}


//At this point, I want to assemble everything, Identity + Hundreds + Dozens + Units end to end (ex: 1338027 for unit 1, lum 27%)

unsigned long FedEx[]={Identity,Hundreds,Dozens,Units}; //So here I "create" it, as an array

mySwitch.send(FedEx[0,1,2,3],24); //But once I send it ... It doesn't send it as a block :/
Serial.println(FedEx[0]); //So i tried outputing each chunk to see if they were properly stored, and they are
Serial.println(FedEx[1]);
Serial.println(FedEx[2]);
Serial.println(FedEx[3]);
//But whenever I tried to output FedEx[0,1,2,3] in serial -> fail.

// So if anyone would be kind enough to tell me how to "assemble" arrays into one unsigned long to send it over 433Mhz radios
// that'd be really awesome :)

// (Otherwise I'll just have to set-up a two-time protocol, call the unit then tell it how bright it's supposed to be, but for some reason I have a feeling that I'll screw that up too :p)
  
  
}

Thanks in advance :slight_smile:

What error messages do you get ?

Don't write such long lines of code.

mySwitch.send(FedEx[0,1,2,3],24);

This isn't C/C++ code at all.

Instead of wasting your time and ours writing random nonsense, find an elementary textbook or online tutorial on basic C/C++ language and syntax.

So if anyone would be kind enough to tell me how to "assemble" arrays into one unsigned long

Unless your "array" consists of 4 bytes, or fewer, you can't put it into a long.

mySwitch.send(FedEx[0,1,2,3],24); //But once I send it ... It doesn't send it as a block :/

Try this:

  int i = (0, 1, 2, 3);
  Serial.println (i);

That prints "3" and only that.

Now this:

  char foo [] = "fubar";
  Serial.println (foo [0, 1, 2, 3]);

That prints "a" and only that.

//But whenever I tried to output FedEx[0,1,2,3] in serial -> fail.

Indeed, it doesn't work like that. Google the "C comma operator".

If you just want to print a long message there is no need to join things beforehand

These two have the same effect

Serial.println("This is a test");

and

Serial.print("This");
Serial.print(' ');
Serial.println("is a test");

...R