|
|
@ -44,12 +44,15 @@ void loop() { |
|
|
|
Serial.println(); |
|
|
|
} |
|
|
|
|
|
|
|
if (ss.available() > 0) |
|
|
|
gps.encode(ss.read()); |
|
|
|
|
|
|
|
unsigned long currentMillis = millis(); |
|
|
|
if (currentMillis - previousMillis >= interval) { |
|
|
|
previousMillis = currentMillis; |
|
|
|
|
|
|
|
// Gather GPS data
|
|
|
|
if (gps.encode(ss.read()) && gps.location.isValid()) { |
|
|
|
if (gps.location.isValid()) { |
|
|
|
Serial.println("Valid GPS"); |
|
|
|
lat = gps.location.lat(); |
|
|
|
lng = gps.location.lng(); |
|
|
@ -70,13 +73,10 @@ void loop() { |
|
|
|
|
|
|
|
if (!status) { |
|
|
|
Serial.println("Failed to encode"); |
|
|
|
} else { |
|
|
|
Serial.print("Status: "); |
|
|
|
Serial.println(status); |
|
|
|
} |
|
|
|
|
|
|
|
Serial.print("Sending packet Lat / Long: "); |
|
|
|
Serial.print(lat); |
|
|
|
Serial.println(lat); |
|
|
|
Serial.println(lng); |
|
|
|
|
|
|
|
// send packet
|
|
|
|