Need help with GPS using tinygps library

Hello today my laptop die out the hard drive i lost my whole library. but i mange before to backup most of it one thing i don't have is the TinyGPS library or the gps sketch i had before does anyone know where i can find a library and sketch?

i think i found the one i use to use gps sketch

#include <SoftwareSerial.h>
SoftwareSerial mySerial(7,8);
#include <TinyGPS.h>

long lat,lon;
TinyGPS gps;

void setup()
{
  Serial.begin(19200);
  mySerial.begin(9600);
}

void loop()
{
  while(mySerial.available())
  {
    if(gps.encode(mySerial.read()))
    {
      gps.get_position(&lat,&lon);
      
      Serial.print("Position: ");
      Serial.print("lat: ");Serial.print(lat);Serial.print(" ");
      Serial.print("lon: ");Serial.println(lon);Serial.print(" ");
    }
  }
}

but nothing comes up in the serial monitor all blank.

An early version of tinyGPS and some test sketches can be downloaded here, among other places TinyGPS | Arduiniana

Hello thank you i have the library all ready and nothing comes up i even tried changing the pins from 7, 8 t o0,1 even 1, 2 and nothing same thing.

i would of at least seen some text in the serial monitor says Serial.print("lat: "); and Serial.print("lon: "); but not even that.

josephchrzempiec:
i would of at least seen some text in the serial monitor says Serial.print("lat: "); and Serial.print("lon: "); but not even that.

I would have at least seen some code, if you had bothered to post it. No psychics here, mate.

i did post a sketch it's at the top of this post.

He posted the code in post #2.

Nothing will be printed on the monitor unless this statement becomes true:

if(gps.encode(mySerial.read()))

It will not be true until a valid sentence has been received, so you are not getting valid GPS sentences. There are many possible reasons why not, but first check that the GPS is working before using tinyGPS.

GPS on is there is a Signal green led flashing showing it connected to a gps satellite that so part is correct.

josephchrzempiec:
i did post a sketch it's at the top of this post.

oops! No idea why I missed that.

Anyway, here's a simple GPS sketch that lets you change the baud rate you use to talk to the GPS. Note that it does not change the baud rate of the GPS itself, just the Serial baud rate you use to talk to it.

I wrote this for a Mega, so you will need to use SoftwareSerial insted of Serial1. On your Serial monitor, set "No line endings", and send it 0, 1, 2, 3, and 4, one at a time. You should see sentences at one of those rates, even if they are not fixes. This will tell you if the GPS has a good fix.

unsigned long baud[] = {4800, 9600, 19200, 57600, 115200};
byte indx = 0;

void setup() {
  Serial.begin(115200);
  Serial1.begin(baud[0]);
  inform();
}

void loop() {
    if (Serial.available()) {
      char ch = Serial.read();
      Serial.print("\n***********************************  ");
      Serial.println (ch);
      if (ch >= '0' && ch <= '4') {
        indx = ch - '0';
        Serial1.end();
        delay(500);
        inform();
        Serial1.begin(baud[indx]);
      }
    }

    if (Serial1.available()) {
      char inbyte = Serial1.read();
      Serial.print(inbyte);
    }
}

void inform() {
  Serial.print("\nGPS serial is set to ");
  Serial.print(baud[indx]);
  Serial.println(" baud");
}

"hello thank you it said Serial1" was not declared in the scope not sure what that means.

I'm asking anyone if they have a Simple GPS sketch that works on the TinyGPS library I'm using D2,D3 pins something that tells the longitude and latitude that's all can someone please help meout?

josephchrzempiec:
"hello thank you it said Serial1" was not declared in the scope not sure what that means.

As I said,

I wrote this for a Mega, so you will need to use SoftwareSerial insted of Serial1. On your Serial monitor, set "No line endings", and send it 0, 1, 2, 3, and 4, one at a time. You should see sentences at one of those rates, even if they are not fixes. This will tell you if the GPS has a good fix.

Put in the lines for including SoftwareSerial and for the SoftwareSerial.begin(), then change any instances of Serial1 to whatever you named your SoftwareSerial.

Libraries are good in many ways, but sometimes they hide things from you. In the case of these little GPS modules, they take very little code to get a response that can be seen without a library getting in the way. As someone else pointed out, you will see nothing if the library does not get a valid fix. Accessing the GPS directly will show you what's happening.

Hello that is not helping me. i just need to find a sketch with the gps on it using the tinygps library i had one lost it looked all over and couldn't find it again i really need help.

josephchrzempiec:
Hello that is not helping me. i just need to find a sketch with the gps on it using the tinygps library i had one lost it looked all over and couldn't find it again i really need help.

It is helping you. You need to know whether or not your GPS is reacting the way you think it should. If you aren't willing to figure it out, even by trying the code I supplied, then I guess you're going to have to "find some code" and hope it works.

I'm outta here. Good luck.

We don't mean to sound cold or harsh, but the Arduino platform was designed for people to learn new skills and build interesting projects. It was never designed to be a plug-and-play consumer type product. There are many on this forum that enjoy helping people but not necessarily writing or locating sketches for beginners.

my GPS was acting great i had no problems with it. I put the project away because i was working on something else with my uno board so i came back to it and pick up where i lost off then my hard drive die out and i lost all my sketches and libraries one of them was the GPS sketch i had.

josephchrzempiec:
my GPS was acting great i had no problems with it. I put the project away because i was working on something else with my uno board so i came back to it and pick up where i lost off then my hard drive die out and i lost all my sketches and libraries one of them was the GPS sketch i had.

That's a dog ate my homework kind of excuse. The sketch wasn't important enough that you made a back-up copy, so I guess you will have to search for it again. If you had written it yourself then recreating it would have been less painful.

i found the sketch in here but i been looking and i can't find it no more. and yes i been looking i haven't stopped yet.

There are a number of things you have not done.

You have not verified communication between your aduino and your computer. You say you see nothing at all in the serial monitor. I would suggesting writing something like "hello world" from your setup() function, to verify that communication is working.

You seem to not understand that you need two serial ports on your arduino, one to communicate to the computer and the other to the gps. You will need to understand this issue, properly.

You don't know that your gps is working. Suggestion. Write a sketch to echo the serial output from the gps device directly to the serial monitor. This will verify that your gps is working, and sending out NMEA strings. After you see this is working, then you can worry about parsiing the strings and extracting the information using tinygps.

You should look at tinygpsplus or tinygps+ which is a newer, better, version of tinygps.