XCTU problem with code

Hi, I use this code and XCTU shows the action required message and I cant connect my xbee to xctu, I need set the blink program for connect the arduino to XCTU. How can i read the codes sended from my Raspberry?

/*****************************************************************
XBee_Serial_Passthrough.ino

Set up a software serial port to pass data between an XBee Shield
and the serial monitor.

Hardware Hookup:
  The XBee Shield makes all of the connections you'll need
  between Arduino and XBee. If you have the shield make
  sure the SWITCH IS IN THE "DLINE" POSITION. That will connect
  the XBee's DOUT and DIN pins to Arduino pins 2 and 3.

*****************************************************************/
// We'll use SoftwareSerial to communicate with the XBee:
#include <SoftwareSerial.h>
// XBee's DOUT (TX) is connected to pin 2 (Arduino's Software RX)
// XBee's DIN (RX) is connected to pin 3 (Arduino's Software TX)
SoftwareSerial XBee(2, 3); // RX, TX

void setup()
{
  // Set up both ports at 9600 baud. This value is most important
  // for the XBee. Make sure the baud rate matches the config
  // setting of your XBee.
  XBee.begin(9600);
  Serial.begin(9600);
}

void loop()
{
  if (Serial.available())
  { // If data comes in from serial monitor, send it out to XBee
    XBee.write(Serial.read());
  }
  if (XBee.available())
  { // If data comes in from XBee, send it out to serial monitor
    Serial.write(XBee.read());
  }
}

xd_avid:
Hi, I use this code and XCTU shows the action required message …

What does it say what action is required? More details please. Screenshots.

and I cant connect my xbee to xctu, I need set the blink program for connect the arduino to XCTU.

Which Arduino model do you have? Also, the blink program has nothing to do with serial communication. Why do you need that? The code below should do fine on an Arduino, assuming you have the Xbee connected to the software serial pins 2 and 3 properly. Explain more about how you have the Xbee connected to the Arduino model you use.

How can i read the codes sended from my Raspberry?

/*****************************************************************

XBee_Serial_Passthrough.ino

Set up a software serial port to pass data between an XBee Shield

and the serial monitor.

Hardware Hookup:

The XBee Shield makes all of the connections you’ll need

between Arduino and XBee. If you have the shield make

sure the SWITCH IS IN THE “DLINE” POSITION. That will connect

the XBee’s DOUT and DIN pins to Arduino pins 2 and 3.

*****************************************************************/

// We’ll use SoftwareSerial to communicate with the XBee:

#include <SoftwareSerial.h>

// XBee’s DOUT (TX) is connected to pin 2 (Arduino’s Software RX)

// XBee’s DIN (RX) is connected to pin 3 (Arduino’s Software TX)

SoftwareSerial XBee(2, 3); // RX, TX

void setup()

{

// Set up both ports at 9600 baud. This value is most important

// for the XBee. Make sure the baud rate matches the config

// setting of your XBee.

XBee.begin(9600);

Serial.begin(9600);

}

void loop()

{

if (Serial.available())

{ // If data comes in from serial monitor, send it out to XBee

XBee.write(Serial.read());

}

if (XBee.available())

{ // If data comes in from XBee, send it out to serial monitor

Serial.write(XBee.read());

}

}

You do know that the Raspberry pi is very different from an Arduino, right? This code does not work on a Raspberry pi.

Sorry for my little information

Valen:
What does it say what action is required? More details please. Screenshots.

This message : [https://cdn.sparkfun.com/assets/learn_t ... window.png](https://cdn.sparkfun.com/assets/learn_tutorials/2/2/3/reset-window.png)

aWhich Arduino model do you have? Also, the blink program has nothing to do with serial communication. Why do you need that? The code below should do fine on an Arduino, assuming you have the Xbee connected to the software serial pins 2 and 3 properly. Explain more about how you have the Xbee connected to the Arduino model you use.

I have Arduino Uno, but i use this item for conect xbee to arduino : [https://www.google.es/search?q=arduino+ ... eROEyPM%3A](https://www.google.es/search?q=arduino+shield+xbee&newwindow=1&client=opera&hs=V0T&source=lnms&tbm=isch&sa=X&ved=0ahUKEwjq1eXMh9LJAhVBthoKHYtIBvIQ_AUIBygB&biw=1920&bih=970#imgrc=_DjMuEdeROEyPM%3A)

without a code that uses serial port i can read the messages send from Raspberry, but when i use any code that use serial port i can’t connect the arduino xctu and shows the message of before. At same time, if i use the arduino ide i can’t read the messages sent from raspberry, but if i delete this code and i put the blink code then i can read the messages sent from raspberry using the monitor of arduino ide

You do know that the Raspberry pi is very different from an Arduino, right? This code does not work on a Raspberry pi.

I know that, and i use another code for Raspberry

xd_avid:
Sorry for my little information

Valen:
What does it say what action is required? More details please. Screenshots.

This message : [https://cdn.sparkfun.com/assets/learn_t ... window.png](https://cdn.sparkfun.com/assets/learn_tutorials/2/2/3/reset-window.png)

To reset the XBee you need to connect it’s reset pin to ground for a short moment. It’s the 5th pin from the top left, if you have the tappered end upwards. I don’t know if your Xbee shield has a reset pin dedicated for this. Check a pin layout drawing to be sure which pin you need.

aWhich Arduino model do you have? Also, the blink program has nothing to do with serial communication. Why do you need that? The code below should do fine on an Arduino, assuming you have the Xbee connected to the software serial pins 2 and 3 properly. Explain more about how you have the Xbee connected to the Arduino model you use.

I have Arduino Uno, but i use this item for conect xbee to arduino : [https://www.google.es/search?q=arduino+ ... eROEyPM%3A](https://www.google.es/search?q=arduino+shield+xbee&newwindow=1&client=opera&hs=V0T&source=lnms&tbm=isch&sa=X&ved=0ahUKEwjq1eXMh9LJAhVBthoKHYtIBvIQ_AUIBygB&biw=1920&bih=970#imgrc=_DjMuEdeROEyPM%3A)

There are a couple of different Xbee shields on that google search result. Please be specific which one you have. It matters to know how it works or find schematics of it.

.

without a code that uses serial port i can read the messages send from Raspberry, but when i use any code that use serial port i can’t connect the arduino xctu and shows the message of before. At same time, if i use the arduino ide i can’t read the messages sent from raspberry, but if i delete this code and i put the blink code then i can read the messages sent from raspberry using the monitor of arduino ide

I’m sorry, that makes little sense. You can read data from the Raspberry Pi without serial code. And not if you do use serial code. That sounds like bizarre magic. I understand english is not your native language, so please show more pictures or drawing of how you have everything set up.

The arduino uno only has one hardware serial port which is shared between the pins D0 and D1`and the USB port to the pc. In order to also communicate with the Xbee at the same time you need to make use of a software-based serial port. The code you showed first does exactly that if the Xbee is properly connected. So please show how you did it.

Valen:
To reset the XBee you need to connect it’s reset pin to ground for a short moment. It’s the 5th pin from the top left, if you have the tappered end upwards. I don’t know if your Xbee shield has a reset pin dedicated for this. Check a pin layout drawing to be sure which pin you need.

There are a couple of different Xbee shields on that google search result. Please be specific which one you have. It matters to know how it works or find schematics of it.

The shield have a button reset, I press this button and the message doesn't dissapears. I tried press the reset button from arduino and same.

I have this arduino uno : http://tienda.bricogeek.com/arduino/305 … o-uno.html

I have this xbee shield : http://tienda.bricogeek.com/arduino/14- … hield.html

I’m sorry, that makes little sense. You can read data from the Raspberry Pi without serial code. And not if you do use serial code. That sounds like bizarre magic. I understand english is not your native language, so please show more pictures or drawing of how you have everything set up.

The arduino uno only has one hardware serial port which is shared between the pins D0 and D1`and the USB port to the pc. In order to also communicate with the Xbee at the same time you need to make use of a software-based serial port. The code you showed first does exactly that if the Xbee is properly connected. So please show how you did it.

I know my english is very bad, sorry for that, i'm learning to be better english. I will try to explain better.

I use blink code, then I go to Tools → Serial Monitor. Now if i send a message from Raspberry to Arduino i can see this message on Serial Monitor.

If i use the code of bottom, when i go to Tools → Serial Monitor and i send a message from Raspberry to Arduino i can’t see nothing on Serial Monitor.

Please, can you provide me a code for xbee for turn on/off a led? Maybe i learn more if i can see a code more explicit.

#include <SoftwareSerial.h>
// XBee's DOUT (TX) is connected to pin 2 (Arduino's Software RX)
// XBee's DIN (RX) is connected to pin 3 (Arduino's Software TX)
SoftwareSerial XBee(2, 3); // RX, TX

void setup()
{
// Set up both ports at 9600 baud. This value is most important
// for the XBee. Make sure the baud rate matches the config
// setting of your XBee.
  XBee.begin(57600);
  Serial.begin(57600);

}

void loop()
{
  if (Serial.available())
  { // If data comes in from serial monitor, send it out to XBee  
    XBee.write(Serial.read());
    Serial.println(Serial.read());
  }

  if (XBee.available())
  { // If data comes in from XBee, send it out to serial monitor
    Serial.write(XBee.read());
    Serial.println(Serial.read());
  }
}

xd_avid:
The shield have a button reset, I press this button and the message doesn’t dissapears. I tried press the reset button from arduino and same.

I have this arduino uno : http://tienda.bricogeek.com/arduino/305 … o-uno.html

I have this xbee shield : http://tienda.bricogeek.com/arduino/14- … hield.html

Ok, now we know which xbee shield it is this starts to make sense.

Xbee Reset:

The switch on the Shield only resets the Arduino, not the XBee. To do that you must touch the 5th pin (start counting from the year/copyright label) on the XBee to GND with a wire.

XBee vs Arduino vs Serialmonitor vs Raspberry Pi communication:

That Xbee shield has the Arduino connected to the USB port/Serial monitor and the Xbee at the same time if the XBEE/USB jumpers are set to the XBEE side. When you run the blink program then the Arduino is not using the serials port, and any data can go undisturbed to/from the Xbee to the USB port and the serial monitor on the pc. So data from the Raspberry Pi shows up in serial terminal. Once you run that code you posted the Arduino is using the serial port to send itself, which is disturbing what the Xbee is transmiting and receiving. Also, the program expect the Xbee to be listening on pin D2 and sending on D3. But there is no connection to those pins with this Xbee shield.

That code you posted will not work without 2 additional jumper wires to connect the Xbee RX and TX pins to other free pins off the Arduino. You would have to remove the 2 jumper blocks from the USB/XBEE pins shield, and instead connect the center pins to the Arduino pins D2 and D3. (or choose other pin numbers and correct the software serial pins in the code) I don’t know which of the two center pins should go to D2, or D3 likewise. The schematic or images I found with Google are not clear about which set of pins belongs to Xbee TX and RX. If it does not work then try swapping them around.

If you must use other Arduino pins than D2 and D3 then change this in the Arduino code

#include <SoftwareSerial.h>
// XBee's DOUT (TX) is connected to pin 2 (Arduino's Software RX)
// XBee's DIN (RX) is connected to pin 3 (Arduino's Software TX)
SoftwareSerial XBee(2, 3); // RX, TX

I know my english is very bad, sorry for that, i’m learning to be better english. I will try to explain better.

Please, can you provide me a code for xbee for turn on/off a led? Maybe i learn more if i can see a code more explicit.

No problem about the language barrier. But there are plenty of examples on the web or youtube showing how to do that with a single. Probably also in Spannish. You do not need code, or even an arduino or raspberry pi or 2nd Xbee to do this. Send the appropriate commands from XCTU to the Xbee to set the Digital pins. Either by AT commands, or use the configuration registers to set the digital pins (make sure there is an empty program running on the Arduino so it doesn’t use serial port) Ofcourse you do need a led with resistor connected to one of the free digital pins of the Xbee. The asscociate LED is already available for that on the shield. It is connected to Xbee pin AD5/Dio5. I understand it is dificult, but to properly learn how to use the Xbee you should read it’s manual.

I’m Sorry too much for my late response, but i didn’t have time for continue with my project by my job. Now that I already read your comment and I logged successfully my arduino with raspberry and I understand better how it works it. I’m very grateful, thanks to you i can continue with my project. Thanks too much!!