-
-
Save sarasantos/7f3061413aca9d9699ca4c8ff928863a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <TinyGPS++.h> | |
static const uint32_t GPSBaud = 9600; | |
// The TinyGPS++ object | |
TinyGPSPlus gps; | |
// The serial connection to the GPS device | |
HardwareSerial ss(2); | |
void setup(){ | |
Serial.begin(9600); | |
ss.begin(GPSBaud); | |
} | |
void loop(){ | |
// This sketch displays information every time a new sentence is correctly encoded. | |
unsigned long start = millis(); | |
do{ | |
while (ss.available() > 0) | |
gps.encode(ss.read()); | |
Serial.print("It's here"); | |
// if (gps.location.isUpdated()){ | |
Serial.print("Latitude= "); | |
Serial.print(gps.location.lat(), 6); | |
Serial.print(" Longitude= "); | |
Serial.println(gps.location.lng(), 6); | |
Serial.print("Raw date DDMMYY = "); | |
Serial.println(gps.date.value()); | |
Serial.print("Raw time in HHMMSSCC = "); | |
Serial.println(gps.time.value()); | |
Serial.print("Speed in km/h = "); | |
Serial.println(gps.speed.kmph()); | |
Serial.print("Altitude in meters = "); | |
Serial.println(gps.altitude.meters()); | |
Serial.print("HDOP = "); | |
Serial.println(gps.hdop.value()); | |
//} | |
} | |
while(millis() - start < 1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment