So, I am trying to make XBee working with 328p controller with no luck so far. I have following connections
Xbee => 328p
pin10(GND) => gnd pin9 (sleep) => D8 (PB0) pin1 (power) => 3.7 V pin2 (UART out) => RXD(PD0) pin3 (UART in) => TXD (PD1)
At the receiver end I have Arduino Uno + Xbee Shield + Xbee.
First of all I am trying to configure the network etc. for microcontroller + Xbee configuration by following code
void setCommands() {
digitalWrite(13, HIGH); // set the LED on
// put the radio in command mode:
Serial.print("+++");
// wait for the radio to respond with "OK\r"
char thisByte = 0;
while (thisByte != '\r') {
if (Serial.available() > 0) {
thisByte = Serial.read();
}
}
Serial.print("ATDH0\r"); //destination High and Low addresses
Serial.print("ATDL8119\r"); //...
Serial.print("ATMY1999\r"); // set my address (16-bit addressing)
Serial.print("ATID2403\r"); // PAN ID
Serial.print("ATSM1\r"); //sleeping mode
Serial.print("ATD70\r"); //preventing Arduino reset while Xbee on sleep
Serial.print("ATCN\r"); // exit command mode
digitalWrite(13, LOW); // set the LED off
}
Led is for indication when 328p reaches the end of the code. I can see that this program is sending something (probably +++), since the receiver end (programmed to read and print) prints "square" signs.
This code works when micro controller is still connected to Arduino Uno and Xbee through Xbee shield.
At the moment I don't know what is going on and how to correct this. Any help would be appreciated.