Reading Seial1

Hi,

I am missing some thing here to read the in GPSSerial void loop

Please help

Thank you

#include <TinyGPS.h>
#define GPSSerial Serial1
TinyGPS gps;

long lat, lon;
float speed_kmph, hdopGps, sattaliteGps, altitudeGps, dateGpsp, timeGps;
long age, date, time, chars;


void setup() {
    Serial.begin(9600);
    Serial.println("Serial.begin(9600");
     GPSSerial.begin(9600);
    Serial.println("GPSSerial.begin(9600);");
    Serial.println("Read Lat, Lon, speed_kmph, hdop, sattalite, altitude, date, time");  
}


void loop() {

    if (GPSSerial.available()){
      char c = GPSSerial.read();
      gps.encode(c); 
  

              gps.get_position(&lat, &lon, &age);
              Serial.print("Lat/Long: "); Serial.print(lat); Serial.print(", "); Serial.println(lon);

              speed_kmph = gps.f_speed_kmph();
              Serial.print("speed_kmph "); Serial.println(speed_kmph);
              
              hdopGps = gps.hdop() / 10;
              Serial.print("hdopGps "); Serial.println(hdopGps);
              
              sattaliteGps = gps.satellites();
              Serial.print("sattaliteGps "); Serial.println(sattaliteGps);
              
              altitudeGps = gps.f_altitude();
              Serial.print("altitudeGps "); Serial.println(altitudeGps);

              gps.get_datetime(&date, &time, &age);
                Serial.print("Date(ddmmyy): "); Serial.print(date); Serial.print(" Time(hhmmsscc): ");Serial.println(time);




        delay(10000);
    
    }
}

You need to describe your problem better. “missing something to read in” doesn’t really explain what you need. What happens that shouldn’t happen, what shouldn’t happen that does happen?

Have you got a working GPS? In other words, with an example test sketch from the TinyGPS library, do you get valid output?

That delay will destroy any chance of getting a fix. Similarly, all that printing every time you read a single character from the GPS will cause a buffer overflow and prevent you getting a fix.

Use the blink without delay technique to print less frequently while reading from the GPS as often as you can.

Also, try running the output (Serial) faster than the input (Serial1)

aarg:
Have you got a working GPS? In other words, with an example test sketch from the TinyGPS library, do you get valid output?

Yes the with the example test I do get a fix and I can delay the example as much as I want and still have a fix.
Seems some wee in my code I does not read the serial.

Thank you

Hi,

Thanks, i see they use blink with out delay on the GPS.

wildbill:
Use the blink without delay technique to print less frequently while reading from the GPS as often as you can.

But I actually want the read the GPS every 10 min and turn it off.
Thank you

You can turn it off. But when you're trying to get a fix, you need to keep up with the rate of the data coming in. And that means not using big delays. Once it's off again, delay all you like.

TinyGPS is one of many libraries that depend, rightfully, on continuous updating in loop(). To change that, would require throwing away the ability to multitask. Any real delays in loop() will destroy that.