I know that Arduino Mega has 4 Serial ports but I want to use a software serial!
Why? Because I'm going to use a library developed for Arduino Uno with Arduino Mega. And this library uses SoftwareSerial so to avoid to write the entire code converting software serial in hardware serial, I prefer to make the software serial work.
I saw that I can use only pins that support change interrupt for RX like 11, but it doesn't work.
Does anybody have good results with software serial on Arduino Mega?
You're right...
It's a library (Google Code Archive - Long-term storage for Google Code Project Hosting.) that I'm developing for GSM GPRS GPS Shield of Futura / Open-Electronics
(http://www.open-electronics.org/arduino-gsm-shield/).
Now I'm changing the entire library to use the HardwareSerial instead of SoftwareSerial.
I thought that changing the pins of the SoftwareSerial from 4 and 5 (for Arduino Uno) to 10 and 11 was enough... but probably it isn't.
Is it possible that nobody used SoftwareSerial on Mega?
Of course I tried but it doesn't work... I tried with softwareserial because I thinked that was easier then re-write the entire library for convert the softwareserial in hardwareserial.
Thank you for pointing the right direction — and the right pins.
It seems all pins are not equal:
PeterMac:
Digging around in the source code of the library, I came accross the following:
// Specifically for the Arduino Mega 2560 (or 1280 on the original Arduino Mega)
// A majority of the pins are NOT PCINTs, SO BE WARNED (i.e. you cannot use them as receive pins)
// Only pins available for RECEIVE (TRANSMIT can be on any pin):
// (I've deliberately left out pin mapping to the Hardware USARTs - seems senseless to me)
// Pins: 10, 11, 12, 13, 50, 51, 52, 53, 62, 63, 64, 65, 66, 67, 68, 69
So pins 2 & 3 won't work (for receive). Maybe this post can help someone else that has the same problem.
I just found this post on a google search. I know it's only 5 years later, but - thank you for the information. This probably would have been useful to me if it were listed on the pages that explain software serial to begin with.