GPS code help!!

Hello im currently doing a project that involves a GPS displaying the speed of my car. Having a bit of trouble getting the GPS to connect to my Arduino mega.

I have an arduino mega 2560 and PA6C module GPS Link: http://www.ebay.co.uk/itm/280890908793?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649

i have been trying to edit this code to work:

#include <SoftwareSerial.h>

#include <TinyGPS.h>

/* This sample code demonstrates the normal use of a TinyGPS object.
   It requires the use of SoftwareSerial, and assumes that you have a
   4800-baud serial GPS device hooked up on pins 4(rx) and 3(tx).
*/

TinyGPS gps;
SoftwareSerial ss(4, 3);

void setup()
{
  Serial.begin(115200);
  ss.begin(4800);
  
  Serial.print("Simple TinyGPS library v. "); Serial.println(TinyGPS::library_version());
  Serial.println("by Mikal Hart");
  Serial.println();
}

void loop()
{
  bool newData = false;
  unsigned long chars;
  unsigned short sentences, failed;

  // For one second we parse GPS data and report some key values
  for (unsigned long start = millis(); millis() - start < 1000;)
  {
    while (ss.available())
    {
      char c = ss.read();
      // Serial.write(c); // uncomment this line if you want to see the GPS data flowing
      if (gps.encode(c)) // Did a new valid sentence come in?
        newData = true;
    }
  }

  if (newData)
  {
    float flat, flon;
    unsigned long age;
    gps.f_get_position(&flat, &flon, &age);
    Serial.print("LAT=");
    Serial.print(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6);
    Serial.print(" LON=");
    Serial.print(flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6);
    Serial.print(" SAT=");
    Serial.print(gps.satellites() == TinyGPS::GPS_INVALID_SATELLITES ? 0 : gps.satellites());
    Serial.print(" PREC=");
    Serial.print(gps.hdop() == TinyGPS::GPS_INVALID_HDOP ? 0 : gps.hdop());
  }
  
  gps.stats(&chars, &sentences, &failed);
  Serial.print(" CHARS=");
  Serial.print(chars);
  Serial.print(" SENTENCES=");
  Serial.print(sentences);
  Serial.print(" CSUM ERR=");
  Serial.println(failed);
  if (chars == 0)
    Serial.println("** No characters received from GPS: check wiring **");
}

The baud rate on my GPS is 115200 so i have change what i think is that in the code with no luck and also change the RX and TX to pin 0 and 1 as it is on the mega but keep coming up with this screen

Any help would be GREATLY appreciated

You are trying to read/write to the GPS at 4800 but if it is already configured to run at 115200, you need:

  ss.begin(115200);

Pete

Ye I have already tried that with no joy :confused:

Why are you using SoftwareSerial, on pins that do not support software serial, on a device with 4 hardware serial ports?

Because I am a complete noob lol what's does all that mean then?

what's does all that mean then?

It means that you need to connect the GPS to other pins that SoftwareSerial can read. Since you are going to move the GPS anyway, you might as well move it to pins that HardwareSerial can read, instead, and use the Serial1, Serial2, or Serial3 instance that corresponds to the pins you actually use.

Ok going to look into this now, I also am going to put a TFT display on it to display the speed will this need softwareserial or them pins?

Sorted that now and getting gps signal thanks for the help!! Going to have a go at the TFT soon

I also am going to put a TFT display on it to display the speed will this need softwareserial or them pins?

"or them pins"? Yes, you will need them pins.

i have been having a go at getting the TFT working and have wired it up like this:

Just running some sample code on it atm to try and see if i can get it working but all im getting is a blue screen :drooling_face:

Link to display: http://www.ebay.com/itm/1PC-2-2-Inch-SPI-TFT-LCD-Serial-Port-Module-Display-ILI9341-5V-3-3V-New-/271288163472?pt=LH_DefaultDomain_0&hash=item3f2a08dc90