0

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.

asked Jan 20, 2019 at 14:29
1
  • Update: changing the sketch to use HardwareSerial works, but I'd like to understand what's different between the devices here. Commented Jan 20, 2019 at 14:43

1 Answer 1

1

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

answered Jan 20, 2019 at 14:49
1
  • Mega has 4 hardware serial ports, no excuse to be using software serial. Commented Oct 17, 2019 at 16:14

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.