Send array of Infrared codes I'm having a bit of a problem when sending IR Codes stored in variables. I swear I had this convered up already. I don't actually know the reason why I can't use variables in the first place. I receive data over Bluetooth Serial Com and I'm using an Arduino ProMicro as ISP for the Arduino Nano.

I want to send data over Serial comm and then send an IR code to the end receiver.

Here is some of the code():

#include &lt;IRremote.h&gt; // IR Library - Encode/Decode

void irSerial( char SerChar[] ) // Receive array of characters

char IDChar[]={'s', 'i', 'u'}; // List of Serial Char to identify position
String HRD[]={"Power", "Input", "ChaUp"}; // Action referece 
byte CodesIR[]={0x61A0F00F, 0x61A048B7, 0x61A050AF}; // IR Codes
int IRArray = 2; // Size Of The array

if ( SerChar[0] == 's' ) { // Compare Array
  for (int CountIR = 0; CountIR &lt;= IRArray; CountIR++){ // Loop through array
    if ( SerChar[0] == IDChar[CountIR]) {
       bluetooth.println(HRD[CountIR]); // Send String in array - Works
       SendIR.sendNEC(CodesIR[CountIR],32); // Send IR in array position
    }
  }
}
}


There's not a problem with the current expression as it compiles normally and I can send serial data normally finishing the function. If I replace the array CodesIR[CountIR] for example with 0x61A0F00F then it works perfectly.

How can I use a variable instead? Can anyone help? It is the byte CodesIR[] ??

I used a Switch/Case and it works but I prefer a variable/array and less useless coding. Thanks for understanding!
Well as usual it was something stupid (-__-) I changed the byte array for long and it worked perfectly.

Here is the complete code working(): 

#include &lt;IRremote.h&gt; // IR Library - Encode/Decode

void irSerial( char SerChar[] ) { // Receive array of characters

    char IDChar[]={'s', 'i', 'u'}; // List of Serial Char to identify position
    String HRD[]={"Power", "Input", "ChaUp"}; // Action reference 
    long CodesIR[]={0x61A0F00F, 0x61A048B7, 0x61A050AF}; // IR Codes
    int IRArray = 3; // Size Of The array # Edit

    if ( SerChar[0] == 's' ) { // Compare Array
      for (int CountIR = 0; CountIR &lt; IRArray; CountIR++){ // Loop through array # Edit
        if ( SerChar[0] == IDChar[CountIR]) {
           Serial.println(HRD[CountIR]); // Send String in array - Works
           SendIR.sendNEC(CodesIR[CountIR],32); // Send IR in array position
        }
      }
    }
}