0

I have a realy weird problem with my xBee S1 Pro moduls. I used the XCTU software to configure them. I set one Arduino to recive data and the other one to transmit. When i use the XCTU Software to send some testframes, it works, the reciver gets the data. But if i want my arduinos to communicate it dosent work. I assume that the moduls are configured the right way because PC -> Arduino works. So i'll provide the Sketches so you can tell me whats going wrong

reciver

void setup()
{
  pinMode(13, OUTPUT);
  Serial.begin(9600);
}

void loop()
{
  if(Serial.available() > 0){
    digitalWrite(13, HIGH);
    delay(500);
    digitalWrite(13, LOW);
    Serial.print("recived some data: ");
    Serial.println(Serial.read());
    Serial.flush();
  }
}

and now the sender

void setup()
{
  pinMode(13, OUTPUT);
  Serial.begin(9600);
}

void loop()
{
  Serial.println("data");
  Serial.flush();
  digitalWrite(13, HIGH);
  delay(1000);
  digitalWrite(13, LOW);
  delay(4000);
}

whats wrong? any ideas?

Clex
  • 43
  • 8

4 Answers4

1

I would check the connections to the Xbee, i.e. make sure that RX is actually connected to DOUT and TX is connected to DIN. Also if you are sending actual "Frames" then it sounds like you are running your xbees in api mode so you will need to do more then just send out "data" what you want is for it to be running in serial pass through mode.

One last thing to check is if you are using arduino Leonardo or Micro the hardware Serial port is Serial1 not Serial.

0

You're using the same Serial port for communicating with XBee and USB. That's the problem. You need to set another Serial port instead of the used for USB to communicate with XBee.

It will be good if you share what arduino boards and shields you are using.

jmarti
  • 1
0

So first thing is first... If these xBees have separate passcodes at a different baud rate, shit is going to happen. Also what command mode are these in (AT or API)? Factory default settings ? Accepting AT commands to change these ? (By default you are in AT mode)

Open a serial program (I use coolTerm for OS X ). Ensure to setup correctly of these steps.

Once you know these transmitters are talking at the same baud, passcode, etc... Ensure you have the code uploaded to your Arduinos BEFORE connecting these transmitters to the RX/TX pins with a simple serial read and write.

danieljay
  • 113
  • 2
  • 11
0

The code seems right, but make sure what you are trying to send. Xbees can transmit and receive 8bit data only. First send a known byte of data such as a=100; and see whether this data receives there perfectly or not.