user39212: I have a simple sketch working on arduino Uno and Nano sending data using an XBee.
However, if I run the project on an Arduino Mega it does not work.
What differences between Uno/Nano and the Mega could be causing issues?
Connection:  I just connect 3.3V->3.3V, Gnd->Gnd, and have tried various ports for DIN and DOUT (normally pins 2/4, but have tried A0/A1, 22/23 etc..).
Sketch: pastebin
Have brought a second Mega in case of hardware faults, but the problem persists.  Have stripped anything which might be tying up a timer.  Am choosing the right board type in the arduino IDE.

user39212: Not all arduino Mega pins support 'change interrupts', which is needed for Software Serial.  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).

39212: <p>I have a simple sketch working on arduino Uno and Nano sending data using an XBee.
However, if I run the project on an Arduino Mega it does not work.</p>

<p>What differences between Uno/Nano and the Mega could be causing issues?</p>

<p>Connection:  I just connect 3.3V->3.3V, Gnd->Gnd, and have tried various ports for DIN and DOUT (normally pins 2/4, but have tried A0/A1, 22/23 etc..).</p>

<p>Sketch: <a href="https://pastebin.com/fKdK1r76" rel="nofollow noreferrer">pastebin</a></p>

<p>Have brought a second Mega in case of hardware faults, but the problem persists.  Have stripped anything which might be tying up a timer.  Am choosing the right board type in the arduino IDE.</p>
 39212: <p>Not all arduino Mega pins support 'change interrupts', which is needed for Software Serial.  Only the following can be used for RX:</p>

<p>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).</p>
