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.