Skip to content

Instantly share code, notes, and snippets.

@TakehikoShimojima
Last active May 26, 2018 12:52
Show Gist options
  • Save TakehikoShimojima/0b165ba109260c70a084d4cae5a6f8e8 to your computer and use it in GitHub Desktop.
Save TakehikoShimojima/0b165ba109260c70a084d4cae5a6f8e8 to your computer and use it in GitHub Desktop.
#include <M5Stack.h>
#include <TinyGPS++.h>
HardwareSerial GPS_s(2);
TinyGPSPlus gps;
void setup() {
M5.begin();
GPS_s.begin(9600);
}
void loop() {
while (!gps.location.isUpdated()) {
while (GPS_s.available() > 0) {
if (gps.encode(GPS_s.read())) {
break;
}
}
}
Serial.printf("lat: %f, lng: %f\r\n", gps.location.lat(), gps.location.lng());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment