I am using the trying to get data from the Neo-6M GPS module with an Arduino mega, but, the condition 'While (gpsSerial.available() > 0' is being met. I believe this means the no bytes are being transferred from the module to the serial port but I'm not sure why. The light on the Neo-6M was blinking which means it getting a lock but not giving out the data.

#include <SoftwareSerial.h>

// Choose two Arduino pins to use for software serial
int RXPin = 19;
int TXPin = 18;

//Default baud of NEO-6M is 9600
int GPSBaud = 9600;

// Create a software serial port called "gpsSerial"
SoftwareSerial gpsSerial(RXPin, TXPin);

void setup()
  // Start the Arduino hardware serial port at 9600 baud

  // Start the software serial port at the GPS's default baud

void loop()
  // Displays information when new sentence is available.
  while (gpsSerial.available() > 0)

I had it working on an Uno by connecting to pins 2,3 rather then 18 and 19. I have also tried swapping the 18 and 19 pins over but still noting.

Thanks for the help

EDIT: I have the RX and TX plugged into the mega at pins 1 and 2, however, it will only print GPS information when the reset button is pressed or held down

1 Answer 1


Not all pins on the Mega support software serial, have a read below:


Pins 18 / 19 are actually hardware serial pins so should not need the use of software serial.

Edit, should have noted to use hardware pins 18 / 19 you would use the constructor Serial1.begin(9600)

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.