yadavkapildev4 / xbee-arduino

Automatically exported from code.google.com/p/xbee-arduino
GNU General Public License v3.0
0 stars 0 forks source link

Access via SoftwareSerial (feature request) #17

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It would be great if the library also supported connecting the XBee to other 
digital pins so that the SoftwareSerial library on Arduino could be used. 
SoftwareSerial has come a long way and is an excellent solution in many 
situations as it removes the annoying port conflict when trying to program the 
Arduino.

Original issue reported on code.google.com by robfal...@gmail.com on 22 Nov 2011 at 7:51

GoogleCodeExporter commented 9 years ago
I have been playing with the later development release of this library and have 
gotten it to compile with SoftwareSerial by making a few modifications.  Other 
mods are required by the use of the latest (1.0) release of Arduino.cc

a.   Change references to WProgram.h to Arduino.h
b.  Change serial library to SoftwareSerial (throughout code), and changed the 
include to have relative path:
 #include "..\SoftwareSerial\SoftwareSerial.h"
c.  In the following code:
void XBee::print(uint8_t val) {
    if (_useNss) {
        _nssSerial->print(val, BYTE);
    } else {
        _serial->print(val, BYTE);
    }
}
Change BYTE to HEX
d.  Added #include <SoftwareSerial.h> to the sketch itself.

I have not yet tested the code, but intend to do so shortly.

Original comment by Cayenne...@gmail.com on 16 Dec 2011 at 5:16

GoogleCodeExporter commented 9 years ago
Okay, test revealed that changing Byte to HEX is bad. Maybe just a simple 
Serial.print command.  This works in the non-NSS version as follows:

void XBee::sendByte(uint8_t b, bool escape) {

    if (escape && (b == START_BYTE || b == ESCAPE || b == XON || b == XOFF)) {
//      std::cout << "escaping byte [" << toHexString(b) << "] " << std::endl;
        Serial.write(ESCAPE);
        Serial.write(b ^ 0x20);
    } else {
        Serial.write(b);
    }

}

Original comment by Cayenne...@gmail.com on 17 Dec 2011 at 3:23

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Any news about this feature? 
I am still looking for this problem solution.

Original comment by Nardello...@gmail.com on 14 Feb 2012 at 10:53

GoogleCodeExporter commented 9 years ago
Andrew has uploaded a new experimental version, using a patch I wrote to enable 
using SoftwareSerial.

It needs beta testing.  Please, if you're interested in SoftwareSerial support, 
give it a try and report your results?

Original comment by paul.sto...@gmail.com on 16 Oct 2012 at 8:34

GoogleCodeExporter commented 9 years ago
This was resolved with Paul's contribution back in 0.4 beta. I'm just getting 
around to updating issue statues

Original comment by andrew.rapp@gmail.com on 2 Feb 2014 at 6:41