Xbee and NewSoftSerial

Hey guys and girls,
Can I use NewSoftSerial library with my xbee transceiver instead of tx and rx pins 0 & 1 on the Arduino Duemilanove to read AND write to the Xbee board? Any one get this library to work with the Xbee transceiver?

Rico Bravo

Yes, yes and yes.

I'm working on a project that using 2 Arduino/Xbee pairs and both are using NewSoftSerial for the bi-directional communication to/from the Xbees.

Also, Does NewSoftSerial have a flush() method???

NewSoftSerial Xbee(8,9);

Can I do:

I believe the developer (mikalhart) is planning to add that.


In the meantime it's trivial to implement it yourself with:

void MyFlush() {
  while (Xbee.available() > 0)
    char c = Xbee.read();

Just call MyFlush() anytime you want to flush the Xbee buffer.

That's right. Thanks, etracer. FWIW, the highest priority items for the next NewSoftSerial are:

  1. 8MHz support
  2. flush()

Other features on the horizon are:

  1. Support for inverted logic
  2. (possibly) RTS/CTS flow control support
  3. (possibly) 20MHz support