
Arduino Code:
/*
RXD Arduino Pin 3
TXD Arduino Pin 2
RST Leave Open (Connect to a N/O momentary switch pulled low to reset?)
NC Leave Open
GND Ground
VCC +5
Make sure you download TinyGPS.h
*/
#include <TinyGPS.h>
#include <SoftwareSerial.h>
bool feedgps(){
while (GPS.available())
{
if (gps.encode(GPS.read()))
return true;
}
return 0;
}
void gpsdump(TinyGPS &gps)
{
//byte month, day, hour, minute, second, hundredths;
gps.get_position(&lat, &lon);
LAT = lat;
LON = lon;
{
feedgps(); // If we don't feed the gps during this long
routine, we may drop characters and get checksum errors
}
}
w w w . e k t
2
. c o m
Electronics
Katrangi
Trading
unsigned long fix_age;
SoftwareSerial GPS(2,3);
TinyGPS gps;
void gpsdump(TinyGPS &gps);
bool feedgps();
void getGPS();
long lat, lon;
float LAT, LON;
void setup(){
GPS.begin(9600);
Serial.begin(115200);
}
void loop(){
long lat, lon;
unsigned long fix_age, time, date, speed, course;
unsigned long chars;
unsigned short sentences, failed_checksum;
// ret/- lat/long in 100000ths of a degree
gps.get_position(&lat, &lon, &fix_age);
getGPS();
Serial.print("Latitude : ");
Serial.print(LAT/100000,7);