Closed GoogleCodeExporter closed 9 years ago
Here is my changed file.
Original comment by husl...@gmail.com
on 22 Aug 2012 at 5:24
Attachments:
Here is a minor modification to the XBee constructor, to work on boards where
"Serial" is a USB virtual serial port, but "Serial1" is a real hardware serial
port.
XBee::XBee(): _response(XBeeResponse()) {
_pos = 0;
_escape = false;
_checksumTotal = 0;
_nextFrameId = 0;
_response.init();
_response.setFrameData(_responseFrameData);
// default
#if defined(__AVR_ATmega32U4__) || defined(__MK20DX128__)
_serial = &Serial1;
#else
_serial = &Serial;
#endif
}
A more substantial change, which I'd be happy to contribute, would use Stream
instead of HardwareSerial. That would allow XBee to use NewSoftSerial or
AltSoftSerial. The downside is XBee.begin(baud) would need to be removed
because Stream lacks begin(). In the user's program, Serial.begin(baud) would
be needed before using XBee. Perhaps that change would be worthwhile, to allow
XBee to use software serial?
Original comment by paul.sto...@gmail.com
on 11 Oct 2012 at 4:50
Paul,
Thanks for the fix. I've added your change to the code in subversion. A lot of
people have asked for the ability to use softserial, so that would be great to
add to the library.
Original comment by andrew.rapp@gmail.com
on 15 Oct 2012 at 4:42
Original issue reported on code.google.com by
husl...@gmail.com
on 22 Aug 2012 at 5:23