Our GPS only can get a group of longitude and latitude. We have been mobile the GPS more about 5 meters.
But the longitude and latitude are the same as the initial position.
This program is from this website.
#include <NewSoftSerial.h> // Add to library folder
#include <TinyGPS.h> // Add to library folderTinyGPS gps;
NewSoftSerial nss(6, 255); // Yellow wire to pin 6void setup() {
Serial.begin(115200);
nss.begin(4800);
Serial.println("Reading GPS");void loop() {
bool newdata = false;
unsigned long start = millis();
while (millis() - start < 5000) { // Update every 5 seconds
if (feedgps())
newdata = true;
}
if (newdata) {
gpsdump(gps);
}
}// Get and process GPS data
void gpsdump(TinyGPS &gps) {
float flat, flon;
unsigned long age;
gps.f_get_position(&flat, &flon, &age);
Serial.print(flat, 4); Serial.print(", ");
Serial.println(flon, 4);
}// Feed data as it becomes available
bool feedgps() {
while (nss.available()) {
if (gps.encode(nss.read()))
return true;
}
return false;
}