xbee to xbee

Hello everyone,

I am trying to connect two different xbee modules to two different arduinos, and trying to get them to work by sending data from 1 arduino to another to turn an LED on and off. We're also trying to use the ATmega328s on a breadboard as an standalone arduinos and the xbees on its breakout board. We have on both boards tx to Din and rx to Dout, or receiver programing is this

transmitter

void setup() 
{			
Serial.begin(57600);		
}

void loop() 
{			
Serial.print(HIGH); 		
delay(2000);			
Serial.print(LOW);		
delay(2000);		
 }

receiver

int LEDredPin =10;			
int LEDgreenPin = 11; 			

void setup() 
{				
 Serial.begin(57600);			
 pinMode(LEDredPin, OUTPUT);		
 pinMode(LEDgreenPin, OUTPUT);	
}

void loop() 
{			
  if (Serial.available() > 0) 
    {	
    int dataByte = Serial.read(); 
    if(dataByte == HIGH)
         {		
              digitalWrite(LEDredPin, HIGH);	
              digitalWrite(LEDgreenPin, LOW); 
          }
    else if(dataByte == 'L') 
         {	
              digitalWrite(LEDgreenPin, HIGH);	
              digitalWrite(LEDredPin, LOW);		
         }
     else				
         { 
         digitalWrite(LEDredPin, HIGH);	
         digitalWrite(LEDgreenPin, HIGH);
          }
      }
}

this isnt working, we've tried everything we could find online, but cant get them to work. Does anyone know if we need more components, or are we doing something wrong with the programming. We've also used a computer to reconfigure the arduinos so they have matching settings, using xctu

I am trying to connect two different xbee modules to two different arduinos, and trying to get them to work by sending data from 1 arduino to another to turn an LED on and off.

Which XBees do you have? How have you configured them? What does this code do that you don't want? What does it not do that you do want? You seem to have left out a few details.

We're also trying to use the ATmega328s on a breadboard as an standalone arduinos

What happens when you use real Arduinos? This project is not a beginner project for a standalone Arduino.

We've also used a computer to reconfigure the arduinos so they have matching settings, using xctu

X-CTU is not for configuring Arduinos. It is for configuring XBees.

My initial thought is to try this line to ensure you're converting to an integer instead having the int set to an ASCII code:

int dataByte = Serial.read() - '0';

And maybe tweak your if statements. Why use 'L' instead of LOW?

If you have not conducted an initial communications test between the two Xbee's, I recommend trying this out: Xbee Adapter
First try to communicate from the PC to one Arduino/Xbee and once that works, take the Xbee off the PC and put it on your other Arduino. You should be able to monitor the "Hello World" and "Goodnight Moon" messages using the serial monitors.