Hello!
We have an xBee Pro S2C that is using this library (GitHub - andrewrapp/xbee-arduino: Arduino library for communicating with XBee radios in API mode) very well on a Software Serial connection to ports 2 and 3 on an Arduino Uno. However, when we take the same setup and try it on a Arduino Mega 2560 using any of the ports specified here:
Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69).
We cannot get this setup to work on the Arduino Mega 2560. We did not try every combination of these ports but tried most of them and it continues to fail. We can get successful packets on an Uno on pins 2 and 3.
Code is as follows:
`#include "Arduino.h"
#include "XBee.h"
#include <SoftwareSerial.h>
#define IS_STAR 0
#if IS_STAR
#define rxPin 10 //input
#define txPin 11 //output
#else
#define rxPin 2 //input
#define txPin 3 //output
#endif
#include "SoftReset.h"
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///setup xbee object
XBee xbee = XBee();
SoftwareSerial xBeeSerial = SoftwareSerial(rxPin, txPin);
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Setting up class & contructors
Laser::Laser () {
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
xBeeSerial.begin(9600);
xbee.setSerial(xBeeSerial);
Serial.begin(9600);`
Any thoughts as to why this might not work on a Arduino Mega?