I am using following code
#include <SoftwareSerial.h>
#include <TinyGPS.h>
TinyGPS gps;
SoftwareSerial ss(2, 3);
void setup()
{
Serial.begin(9600);
ss.begin(9600);
}
void loop()
{
while (ss.available())
{
char c = ss.read();
if (gps.encode(c)) // Did a new valid sentence come in?
{
float flat, flon;
unsigned long age;
gps.f_get_position(&flat, &flon, &age);
Serial.print("LAT,LON =");
Serial.print(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6);
Serial.print(",");
Serial.print(flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6);
Serial.print(" SAT=");
Serial.println(gps.satellites() == TinyGPS::GPS_INVALID_SATELLITES ? 0 : gps.satellites());
delay(1000);
}
}
}
But the data return below
LAT,LON =23.614660,121.318542 SAT=0
LAT,LON =23.614669,121.318511 SAT=0
LAT,LON =23.614669,121.318496 SAT=0
LAT,LON =23.614679,121.318511 SAT=0
LAT,LON =23.614679,121.318511 SAT=0
LAT,LON =23.614679,121.318519 SAT=0
The number always is "0"
And my GPS information from serial port are these :
01:38:04 $GPGSV,3,3,12,17,64,074,23,20,10,041,16,23,21,068,17,28,28,177,1572
01:38:04 $GPGLL,2336.88138,N,12119.11377,E,013804.00,A,A60
01:38:05 $GPRMC,013805.00,A,2336.88071,N,12119.11450,E,2.866,,051214,,,A7F
01:38:05 $GPVTG,,T,,M,2.866,N,5.309,K,A26
01:38:05 $GPGGA,013805.00,2336.88071,N,12119.11450,E,1,08,1.06,30.9,M,17.9,M,,60
01:38:05 $GPGSA,A,3,10,17,06,09,02,28,23,20,,,,,1.87,1.06,1.5408
01:38:05 $GPGSV,3,1,12,02,29,294,15,03,01,039,07,05,19,222,,06,49,342,19*7C
01:38:05 $GPGSV,3,2,12,09,33,101,21,10,74,230,26,12,15,316,18,13,08,178,78
01:38:05 $GPGSV,3,3,12,17,64,074,23,20,10,041,15,23,21,068,17,28,28,177,1571
I use 3 types of GPS to try the code with TinyGPS, TinyGPS++ ...no result !! Any suggestion will be appreciated !!