I have done a lot of research on XBee products and their connectivity with Arduino but upon actually wiring two up myslef, I have run into some problems.
My goal (at the moment) is to use the Serial Monitor on PC to send any data to Arduino Uno 1, which receives that data and sends it from XBee 1, to XBee 2. The Arduino Uno 2 then sees that data has come through and digitalWrites to an led.
Arduino Uno 1 Code (Transmitter):
#include <SoftwareSerial.h>
SoftwareSerial Xbee(2,3);
void setup() {
Xbee.begin(9600);
Serial.begin(9600);
}void loop() {
if(Serial.available()) {
Xbee.write(Serial.read());
}
}
Arduino Uno 2 Code (Receiver):
#include <SoftwareSerial.h>
SoftwareSerial Xbee(2,3);
int ledPin = 7;
void setup() {
pinMode(ledPin,OUTPUT);
Xbee.begin(9600);
}void loop() {
if(Xbee.available()) {
digitalWrite(ledPin,HIGH);
}
}
Please note:
- I am sorry if the layout of this topic is unattractive or incorrect in some way, I am new.
Any help would be much appreciated.