I am trying to read the lat and long off of my EM406 that I put onto one of my custom PCBS. There seems to be a glitch when I pull it up in the serial monitor. It seems to give me random readings when I try and take it out to 7 decimal places. If I tell it to give me two decimal places it will give an actual reading but still isnt accurate enough for what im trying to do. Here is the reading on the serial monitor when I set it as 7.
Lat: 63 Lon: 211301422203
The code:
#include <NewSoftSerial.h>
#include "TinyGPS.h"
TinyGPS gps;
NewSoftSerial GPS(5, 4);
float flat, flon;
unsigned long fix_age, time, date, speed, course;
unsigned long chars;
unsigned short sentences, failed_checksum;
void getgps(TinyGPS &gps);
void printFloat(double f, int digits = 7);
void setup() {
Serial.begin(115200);
GPS.begin(4800);
}
void loop()
{
if (GPS.available() > 0){
char c = GPS.read();
if (gps.encode(c))
{
gps.f_get_position(&flat, &flon, &fix_age);
Serial.print("Lat: "); Serial.print(flat, 7); Serial.print(" ");
Serial.print("Lon: "); Serial.print(flon, 7); Serial.println();
}
}
}
