Hi guys,
I don't know why my program isn't working. Here is my setup. I have 2 Xbees S2C both attached to a XBee Shield and then on an Arduino MEGA 2560.
One is the Transmitter (Coordinator) , the other one the Receiver (End Device). I configured both with XCTU. (see configuration attached)
What is the problem?
Receiver:
char data;
const int pin = 13;
void setup() {
Serial.begin(115200);
pinMode(pin,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
while(Serial.available()>0){
data = Serial.read();
Serial.print(data);
if(data == 'H'){
digitalWrite(pin,HIGH);
delay(1000);
}
if(data == 'L'){
digitalWrite(pin,LOW);
delay(1000);
}
}
}
Transmitter:
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.print('H');
delay(4000);
Serial.print('L');
delay(4000);
}
