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