[XBee] Changed pin mapping

This commit is contained in:
jgromes 2019-12-27 13:18:36 +01:00
parent 05b300408b
commit 6f0496e06e
4 changed files with 16 additions and 13 deletions

View file

@ -18,7 +18,7 @@
// TX pin: 9
// RX pin: 8
// RESET pin: 3
XBee bee = new Module(9, 8);
XBee bee = new Module(9, 8, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield

View file

@ -18,7 +18,7 @@
// TX pin: 9
// RX pin: 8
// RESET pin: 3
XBee bee = new Module(9, 8);
XBee bee = new Module(9, 8, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield

View file

@ -20,7 +20,7 @@
// TX pin: 9
// RX pin: 8
// RESET pin: 3
XBeeSerial bee = new Module(9, 8);
XBeeSerial bee = new Module(9, 8, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield

View file

@ -10,7 +10,7 @@ XBee::XBee(Module* mod) {
int16_t XBee::begin(long speed) {
// set module properties
_mod->baudrate = speed;
_mod->init(RADIOLIB_USE_UART, RADIOLIB_INT_1);
_mod->init(RADIOLIB_USE_UART);
// reset module
reset();
@ -52,11 +52,11 @@ int16_t XBee::begin(long speed) {
}
void XBee::reset() {
pinMode(_mod->getInt1(), OUTPUT);
digitalWrite(_mod->getInt1(), LOW);
pinMode(_mod->getRst(), OUTPUT);
digitalWrite(_mod->getRst(), LOW);
delayMicroseconds(200);
digitalWrite(_mod->getInt1(), HIGH);
pinMode(_mod->getInt1(), INPUT);
digitalWrite(_mod->getRst(), HIGH);
pinMode(_mod->getRst(), INPUT);
}
int16_t XBee::transmit(uint8_t* dest, const char* payload, uint8_t radius) {
@ -189,7 +189,10 @@ int16_t XBeeSerial::begin(long speed) {
// set module properties
_mod->AtLineFeed = "\r";
_mod->baudrate = speed;
_mod->init(RADIOLIB_USE_UART, RADIOLIB_INT_NONE);
_mod->init(RADIOLIB_USE_UART);
// reset module
reset();
// empty UART buffer (garbage data)
_mod->ATemptyBuffer();
@ -216,11 +219,11 @@ int16_t XBeeSerial::begin(long speed) {
}
void XBeeSerial::reset() {
pinMode(_mod->getInt1(), OUTPUT);
digitalWrite(_mod->getInt1(), LOW);
pinMode(_mod->getRst(), OUTPUT);
digitalWrite(_mod->getRst(), LOW);
delayMicroseconds(200);
digitalWrite(_mod->getInt1(), HIGH);
pinMode(_mod->getInt1(), INPUT);
digitalWrite(_mod->getRst(), HIGH);
pinMode(_mod->getRst(), INPUT);
}
int16_t XBeeSerial::setDestinationAddress(const char* destinationAddressHigh, const char* destinationAddressLow) {