Any one is got exp on MaxStream XBee wireless communication?
I tried to do a one way communication from one Arduino to another but not sure what problem is.
I set up one transmitter with a push button and tried to light leds up on receiver end when button is pushed.
here is my code:
Transmitter Code:
const int ledPin = 13;
const int buttonPin = 12;
char outBabe = 0;
int actPin = 0;
void setup()
{
pinMode(ledPin, OUTPUT);
pinMode(buttonPin, INPUT);
Serial.begin(9600);
delay(1000);
Serial.print("+++"); // write +++ to enter configuration mode
delay(1000);
// if (returned() == 'T')
// {}
// else
// {
// setup();
// }
Serial.println("ATID3332,DH0x0000,DL0x0001,CN"); //make sure use same setting, ch, addr of receiving
//Destination low at 0
//Destination hight at 1
delay(1000);
// if (returned() == 'T')
// {}
// else
// {
// setup();
// }
}
void loop()
{
actPin = digitalRead(buttonPin);
if (actPin == HIGH)
{
outBabe = '1';
digitalWrite(ledPin,HIGH);
}
else
{
outBabe = '0';
digitalWrite(ledPin,LOW);
}
Serial.println(outBabe);
}
and here is the receiver code
int ledPin = 13;
// a byte to receive data:
char inBabe = 0;
void setup()
{
pinMode (ledPin, OUTPUT);
Serial.begin(9600);
delay(1000);
Serial.print("+++"); // write +++ to enter configuration mode
delay(1000);
//if (returned() == 'T')
//{}
//else
//{
// setup();
//}
Serial.println("ATID3332,MY0x0001,CN"); //setting network id to 3332
//channel to ch0 //address of module to 0x0000
delay(1000);
//if (returned() == 'T')
//{}
//else
//{
// setup(); // if MS XBee is not rdy do it over
//}
}
void loop()
{
if (Serial.available() > 1)
{
inBabe = Serial.read();
}
if (inBabe == '1')
{
digitalWrite(ledPin,HIGH);
delay(1000);
}
else
{
digitalWrite(ledPin,LOW);
}
}