Created
February 29, 2020 20:41
-
-
Save polluxlabs/35e67518248714288c8ca23f40880c1d to your computer and use it in GitHub Desktop.
GPS on Arduino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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