microrobotics icon

TinyGPS Example

microrobotics | PRO | 08/24/17 06:41:19 PM UTC | 0 ⭐ | 1021 👁️ | Never ⏰ | []
C |

430 B

|

None

|

0 👍

/

0 👎

#include "TinyGPS.h"
 
TinyGPS gps;
 
void setup() {
 Serial.begin(4800);
}
 
void loop() {
 while (Serial.available()) {
   int c = Serial.read();
   gps.encode(c);
   Serial.println("oh no, I'm never gonna exit this while loop");
 }
 
 long latitude, longitude;
 gps.get_position(&latitude, &longitude, NULL);
 Serial.print("Latitude:  "); Serial.println(latitude);
 Serial.print("Longitude:  "); Serial.println(longitude);
}

Comments