GPS help required

HI

so im trying to build up a code to simply get latitude and longitude values from a gps unit, needless to say i have bother writing my own yet ive simply been playing around trying to get existing codes to work, starting with the simple test in the examples folder that comes with the tinygps library

im using arduino 1.0 on a windows 7 PC trying to program an arduino uno with a gps shield that uses NEO-6M-0-001 chip

i keep encountering the same problem others do:
the following error

"simple_test:10: error: 'TinyGPS' does not name a type"
it is referring to the code line "TinyGPS gps;"
can someone explain roughly what this line actually does, its about the one part i dont really understand

so far ive tried:
replacing the "wprogram.h" in the libraries to "arduino.h" which just gave more errors.
removing the line all together, this obviously didnt help much
ive tried altering the line a little, (inverted commas, adding & removing spaces etc)
i've tried all of the above on arduino 0022
possibly a few other things too

every example ive found, uses this line, and every time, the compiler has issues with it, i know others have had the same issue on this forum and i've tried the solutions they used which so far, havent worked, though i could be doing something wrong , i wouldnt have posted this if i hadnt already looked round for a solution throughout this site.

& yes i made sure to correct the baud rate & tx & tx for my circuit & shield etc for each program i tried :slight_smile:

Any help would be appreciated!
thanks

Use the newest Arduino IDE.
Tell us which (a link to it) which GPS module you have.
Don't try to use an old library, you will never know which part conflicts with an other part of the software.

To get GPS working, buy the Adafruit module. It has up to date libraries and support on the website.

The error message is that the compiler can't find TinyGPS at all. So you have indeed a problem with the includes or the location of the libraries. Can you show us your sketch ? I hope you don't use a library that you just happen to find somewhere on the internet.

Thanks for your reply

this is the module im using
http://www.ebay.co.uk/itm/like/281074162796?limghlpsr=true&hlpv=2&ops=true&viphx=1&hlpht=true&lpid=108&device=c&adtype=pla&crdt=0&ff3=1&ff11=ICEP3.0.0&ff12=67&ff13=80&ff14=108

i will look into the module you linked, though if i can i'd like to get this one working simply to save money, the reviews i found of it seemed fine, though to be honest if i can even get the code to compile the module isnt going to make much odds YET :slight_smile:

this is the sketch im using at the moment, its one of the examples that came with the library, as far as i know, it is the "proper" gps library, though feel free to let me know as to the location of the real deal :slight_smile:

#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 **");
}

apologies for the slow replies, in the middle of moving home, so currently using the mobile internet on my laptop & trying not to rack up a bill
regards
Sean

apologies, minor correction i am using the newest IDE 1.0.5

youre right about it not finding the libraries, this seems to be the main problem, i've since altered the code to use the "newsoftserial" library instead of the softwareserial library, i.e. one that ive downloaded, not a pre-installed library, & its thrown out more errors, definitely something to do with how i've installed the libraries

Don't use "newsoftserial", it was a transitional version between the old "softserial" and the latest "softwareserial". Or maybe the other way around. Anyway, don't use it, use the latest one.

You need Arduino.h and you need tinygps.h If you can't find those, then the directory structure of your arduino installation on your pc is wrong and you need to fix it up properly, don't just delete random pieces and then expect things to work.

I would recommend using a very simply program to echo the text output from the gps straight to the serial monitor on the pc, then you can verify that your module is working and outputing data ok. After you have seen that, then you can channel the text output of the gps into the tinygps class object which will parse it for you.