Xbee and Arduino Yun / Leonardo

Hello everybody, I have an issue with communication between arduinos via Zigbee.

I have an arduino uno with a zigbee setted as router, that sends a string to the network.

The coordinator, that is in the same network, picks up the string and prints it in the serial monitor.
The coordinator is basically an arduino yun/leonardo with a xbee, setted of course as a coordinator.

If I run this sketch on an arduino leonardo, it works fine, it reads what’s incoming from the arduino uno and prints it to the serial. But if I use an arduino yun, instead, nothing happens.

/*
 send like this:

<M:1-S:0>

'<' is for initiate
'>' is for end

M is for machine status, 1 on, 0 off
S is for smoke status, 1 detected, 0 off

*/

#define SOP '<'
#define EOP '>'

bool started = false;
bool ended = false;

char inData[80];
byte index;

int MachineStatus = 0;

void setup()
{
  Serial.begin(9600);
  Serial1.begin(9600);
}

void loop()
{
  // Read all serial data available, as fast as possible
  while (Serial1.available() > 0)
  {
    char inChar = Serial1.read();

    if (inChar == SOP)
    {
      index = 0;
      inData[index] = '\0';
      started = true;
      ended = false;
      Serial.println("Start detected");
    }

    else if (inChar == EOP)
    {
      ended = true;
      Serial.println("End detected");
      break;
    }

    else
    {
      if (index < 79)
      {
        inData[index] = inChar;
        index++;
        inData[index] = '\0';
      }
    }
  }

  // We are here either because all pending serial
  // data has been read OR because an end of
  // packet marker arrived. Which is it?
  if (started && ended)
  {
    // The end of packet marker arrived. Process the packet

    Serial.println(inData);

    // Reset for the next packet
    started = false;
    ended = false;
    index = 0;
    inData[index] = '\0';
  }
}

Why is that happening? Thanks!

Solved! It seems that the arduino Yun uses the pin 0 to communicate with the Linux Linino. I just moved the tx&rx pins of the xbee from 0 and 1 to pins 10 and 11.

I used this to declare the software serial

#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX

Can you post the code?