Skip to content

Instantly share code, notes, and snippets.

@polluxlabs
Created February 29, 2020 20:41
Show Gist options
  • Save polluxlabs/35e67518248714288c8ca23f40880c1d to your computer and use it in GitHub Desktop.
Save polluxlabs/35e67518248714288c8ca23f40880c1d to your computer and use it in GitHub Desktop.
GPS on Arduino
#include <SoftwareSerial.h>
#include <TinyGPS++.h>
TinyGPSPlus gps;
// Die serielle Verbindung zum GPS Modul
SoftwareSerial ss(4, 3);
void setup() {
Serial.begin(115200);
ss.begin(9600);
}
void loop() {
while (ss.available() > 0) {
gps.encode(ss.read());
if (gps.location.isUpdated()) {
// Breitengrad mit 3 Nachkommastellen
Serial.print("Breitengrad= ");
Serial.print(gps.location.lat(), 3);
// Längengrad mit 3 Nachkommastellen
Serial.print(" Längengrad= ");
Serial.println(gps.location.lng(), 3);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment