L76X_Teensy.ino
1 #include <TinyGPS++.h> 2 3 // Define GPS RX/TX pins (connect GPS TX to Teensy RX1, GPS RX to Teensy TX1) 4 #define GPS_SERIAL Serial1 // Use Serial1 for hardware UART 5 6 TinyGPSPlus gps; // Create TinyGPS++ object 7 8 void setup() { 9 Serial.begin(9600); // Serial monitor for debugging 10 GPS_SERIAL.begin(9600); // Start communication with GPS module 11 12 Serial.println("Waiting for GPS signal..."); 13 } 14 15 void loop() { 16 while (GPS_SERIAL.available()) { 17 gps.encode(GPS_SERIAL.read()); // Feed GPS data to the parser 18 19 if (gps.location.isUpdated()) { // Check if new data is available 20 Serial.print("Latitude: "); 21 Serial.print(gps.location.lat(), 6); // Print latitude with 6 decimal places 22 Serial.print(" Longitude: "); 23 Serial.println(gps.location.lng(), 6); // Print longitude with 6 decimal places 24 } 25 } 26 }