I have Arduino IDE version 1.0.5.
I have connected my Arduino Leonardo through USB to the PC.
I have connected to my Arduino a Xbee module at pins 2 and 3 with SoftwareSerial.
I also have a Xbee module connected to the PC.
Both of the XBee modules are set to API mode 2 (I don’t know if this matters).
This is the code I’m running:
#include <SoftwareSerial.h>
char buffer[256];
SoftwareSerial xbee(2,3);
void setup()
{
xbee.begin(9600);
xbee.listen();
Serial.begin(9600);
}
void loop()
{
if(xbee.available())
{
xbee.readBytes(buffer,xbee.available());
Serial.println(buffer);
}
}
Both the Xbee modules notify serial messages through their LEDs. Both of them were checked to see if they are operational.
The question is simple: why doesn’t the serial port (on 2 and 3 pins) work? When I attach to xbee Serial1 port, it does work, but when I use SoftwareSerial, it doesn’t.