Arduino mega2560 和商城里的GPS 求助怎么显示经度和纬度

本人已纠结于 从GPS获取经纬度 ,代码如下#include <TinyGPS.h>
#include <LiquidCrystal.h>

TinyGPS gps;
long lat, lon;
unsigned long fix_age, time, date, speed, course;
unsigned long chars;
unsigned short sentences, failed_checksum;
int DEG;
int MIN1;
int MIN2;
void LAT(){ //Latitude state
DEG=lat/1000000;
MIN1=(lat/10000)%100;
MIN2=lat%10000;
Serial.println("LAT:");
Serial.print(MIN1);
Serial.print(".");
Serial.print(MIN2);
Serial.print("' ");
Serial.println("");
}
void LON(){ //Longitude state
DEG=lon/1000000;
MIN1=(lon/10000)%100;
MIN2=lon%10000;
Serial.println("LON:");
Serial.print(DEG);
Serial.print(MIN1);
Serial.print(".");
Serial.print(MIN2);
Serial.print("' ");
Serial.println("");
}
void setup()
{
Serial.begin(38400); //Set the GPS baud rate.
delay(10000);
}

void loop()
{
while (Serial.available())
{

int c = Serial.read(); // Read the GPS data
if (gps.encode(c)) // Check the GPS data
{
gps.get_position(&lat, &lon, &fix_age);
// process new gps info here
}
}
gps.get_position(&lat, &lon, &fix_age); // retrieves +/- lat/long in 100000ths of a degree
gps.get_datetime(&date, &time, &fix_age); // time in hhmmsscc, date in ddmmyy
//LAT();
//LON();
Serial.println(lat);
delay(1000);
Serial.println(lon);
}

输出结果如下,可是经度和纬度都是9999999999 哪位大神能说一下哪错了吗
$GPGSV,3,1,09,12,23,127,,14,33,274,25,15,31,073,26,18,87,266,2572
$GPGSV,3,2,09,20,24,134,,21,31,210,21,22,46,307,34,24,66,063,27
75
$GPGSV,3,3,09,25,07,162,184C
$GPGLL,4000.06376,N,11620.45307,E,111024.60,A,A
69
999999999
999999999
999999999
999999999
999999999
999999999
999999999

[img]file:///C:\Users\DELL\Documents\Tencent Files\2991299442\Image\C2C\3)K~HBT$U~$U%QJY2@_HX_Q.png[/img]

标签: Arduino教程