[XBee] Changed pin mapping
This commit is contained in:
parent
05b300408b
commit
6f0496e06e
4 changed files with 16 additions and 13 deletions
|
@ -18,7 +18,7 @@
|
||||||
// TX pin: 9
|
// TX pin: 9
|
||||||
// RX pin: 8
|
// RX pin: 8
|
||||||
// RESET pin: 3
|
// RESET pin: 3
|
||||||
XBee bee = new Module(9, 8);
|
XBee bee = new Module(9, 8, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or using RadioShield
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/jgromes/RadioShield
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
// TX pin: 9
|
// TX pin: 9
|
||||||
// RX pin: 8
|
// RX pin: 8
|
||||||
// RESET pin: 3
|
// RESET pin: 3
|
||||||
XBee bee = new Module(9, 8);
|
XBee bee = new Module(9, 8, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or using RadioShield
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/jgromes/RadioShield
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
// TX pin: 9
|
// TX pin: 9
|
||||||
// RX pin: 8
|
// RX pin: 8
|
||||||
// RESET pin: 3
|
// RESET pin: 3
|
||||||
XBeeSerial bee = new Module(9, 8);
|
XBeeSerial bee = new Module(9, 8, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or using RadioShield
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/jgromes/RadioShield
|
||||||
|
|
|
@ -10,7 +10,7 @@ XBee::XBee(Module* mod) {
|
||||||
int16_t XBee::begin(long speed) {
|
int16_t XBee::begin(long speed) {
|
||||||
// set module properties
|
// set module properties
|
||||||
_mod->baudrate = speed;
|
_mod->baudrate = speed;
|
||||||
_mod->init(RADIOLIB_USE_UART, RADIOLIB_INT_1);
|
_mod->init(RADIOLIB_USE_UART);
|
||||||
|
|
||||||
// reset module
|
// reset module
|
||||||
reset();
|
reset();
|
||||||
|
@ -52,11 +52,11 @@ int16_t XBee::begin(long speed) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void XBee::reset() {
|
void XBee::reset() {
|
||||||
pinMode(_mod->getInt1(), OUTPUT);
|
pinMode(_mod->getRst(), OUTPUT);
|
||||||
digitalWrite(_mod->getInt1(), LOW);
|
digitalWrite(_mod->getRst(), LOW);
|
||||||
delayMicroseconds(200);
|
delayMicroseconds(200);
|
||||||
digitalWrite(_mod->getInt1(), HIGH);
|
digitalWrite(_mod->getRst(), HIGH);
|
||||||
pinMode(_mod->getInt1(), INPUT);
|
pinMode(_mod->getRst(), INPUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t XBee::transmit(uint8_t* dest, const char* payload, uint8_t radius) {
|
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
|
// set module properties
|
||||||
_mod->AtLineFeed = "\r";
|
_mod->AtLineFeed = "\r";
|
||||||
_mod->baudrate = speed;
|
_mod->baudrate = speed;
|
||||||
_mod->init(RADIOLIB_USE_UART, RADIOLIB_INT_NONE);
|
_mod->init(RADIOLIB_USE_UART);
|
||||||
|
|
||||||
|
// reset module
|
||||||
|
reset();
|
||||||
|
|
||||||
// empty UART buffer (garbage data)
|
// empty UART buffer (garbage data)
|
||||||
_mod->ATemptyBuffer();
|
_mod->ATemptyBuffer();
|
||||||
|
@ -216,11 +219,11 @@ int16_t XBeeSerial::begin(long speed) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void XBeeSerial::reset() {
|
void XBeeSerial::reset() {
|
||||||
pinMode(_mod->getInt1(), OUTPUT);
|
pinMode(_mod->getRst(), OUTPUT);
|
||||||
digitalWrite(_mod->getInt1(), LOW);
|
digitalWrite(_mod->getRst(), LOW);
|
||||||
delayMicroseconds(200);
|
delayMicroseconds(200);
|
||||||
digitalWrite(_mod->getInt1(), HIGH);
|
digitalWrite(_mod->getRst(), HIGH);
|
||||||
pinMode(_mod->getInt1(), INPUT);
|
pinMode(_mod->getRst(), INPUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t XBeeSerial::setDestinationAddress(const char* destinationAddressHigh, const char* destinationAddressLow) {
|
int16_t XBeeSerial::setDestinationAddress(const char* destinationAddressHigh, const char* destinationAddressLow) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue