I am writing some code to develop a digital speedometer whose data is pulled and converted using TinyGPS. I am testing the code in my house and am getting a solid red LED on my Parallax GPS unit but there are times when the module is sitting still that I will get speeds of up to 8 mph output in the serial monitor. Has anyone else experienced anomalies of this nature with the GPS units? Attached is my code:
#include <NewSoftSerial.h>
#include <TinyGPS.h>
NewSoftSerial nss (2,3);
TinyGPS gps;
void setup()
{
Serial.begin(4800);
nss.begin(4800);
}
void loop()
{
while (nss.available())
{
int c = nss.read();
if (gps.encode(c))
{
int fmph = gps.f_speed_mph(); // speed in miles/hr
Serial.println(fmph);
}
}
}
Also, please forgive me if I missed it when reading the .h file, but is there any way in TinyGPS to extract the data from the GPRMC that indicates a valid lock (i.e. the 3rd part of the string that is either A or V)? Thanks.
-Jeremy