Advertisement
microrobotics

TinyGPS Example

Aug 24th, 2017
464
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | None | 0 0
  1. #include "TinyGPS.h"
  2.  
  3. TinyGPS gps;
  4.  
  5. void setup() {
  6.  Serial.begin(4800);
  7. }
  8.  
  9. void loop() {
  10.  while (Serial.available()) {
  11.    int c = Serial.read();
  12.    gps.encode(c);
  13.    Serial.println("oh no, I'm never gonna exit this while loop");
  14.  }
  15.  
  16.  long latitude, longitude;
  17.  gps.get_position(&latitude, &longitude, NULL);
  18.  Serial.print("Latitude:  "); Serial.println(latitude);
  19.  Serial.print("Longitude:  "); Serial.println(longitude);
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement