XBee Newbie needs help getting started

Alas, no joy quite yet, but perhaps close. I have tested all aspects of the system-- the remote IR receiver, the IR emitter, the wireless communication. The receiver decodes correctly, and the emitter can control a TV when I manually send the code, the Ardunos can communicate wirelessly. But I cannot get the receiver to talk directly with the emitter to control the TV.

So, here's the setup: Arduino #1 receives the IR signal code from the handheld remote, decodes it and writes the key to the RF serial link. Arduino #2 retrieves the key from the link and drives the IR emitter to control the TV. The key discussed here ie 61A0F00F which turns the TV off and on.

The COM15 is the arduino receiving the IR signal, Arduino #1. Attached is a screen shot of the CoolTerm monitoring COM15, as it sends the code key to the serial port. When I depress the Power button on the remote, this is the code it detects, 61A0F00F. It writes it to the serial port little endien style 0FF0A061.

Here is this portion of the code, as derived with your help:

    myNumber.UL = results->value;
    
    Serial.write(&myNumber.B,4);
    //Serial.print(myNumber.UL, HEX);

WHen I input this code manually to Arduino #2) which drives the emitter, via the CoolTerm program via COM 14, it works fine, the TV turns off and on. COM14 in the attachment shows this. I am also sending the code LSB first, just like it is written by the receiver.

Here is the portion that retrieves the code from the serial port:

void loop() {
int x = 0;
    while (x < 4) {
        if (Serial.available()) myNumber.B[x++] = Serial.read();
    }    Serial.print(myNumber.UL, HEX);
       
 if (x=3) irsend.sendNEC(myNumber.UL, 32);

Yet something is wrong with what Arduino #2 reads from the serial port as output by the arduino #1, because the system does not work using the RF wireless communication.

One thing that doesn't look exactly right is the spaces that appear between the bytes in the COM 15 output. Is there a way to get rid of these, and could they be causing a problem?