I have an Arduino Uno with a Wireless SD Shield and XBee S1 and a PC with another XBee S1 connected to it. What I'm after is for me to be able to send a message from my computer and receive a message back from the Arduino (For now let's just say if the Arduino receives a "1" I want it to send an "A" back) Here is the code I have been practicing with (courtesy of SparkFun)
#include <SoftwareSerial.h>
SoftwareSerial XBee(0, 1); // RX, TX
void setup() {
XBee.begin(9600);
Serial.begin(9600);
}
void loop() {
if (Serial.available()) {
XBee.write(Serial.read());
}
if (XBee.available()) {
Serial.write(XBee.read());
}
}
(I have changed the pins from 2,3 to 0,1 as the latter is on the Arduino itself) I have set my Xbees up and have been able to get them to talk to each other when both connected to separate PC's, but I am having trouble getting the Arduino to send information to the other XBee. When I try and send data from the Arduino IDE both RX and TX Led's flash. Could anyone steer me in the right direction?
I have changed the pins from 2,3 to 0,1
- change it back, no wonder it doesn't work. You can't have HardwareSerial and SoftwareSerial on the same two pins. It doesn't make any kind of sense.