/********* Pleasedontcode.com ********** Pleasedontcode thanks you for automatic code generation! Enjoy your code! - Terms and Conditions: You have a non-exclusive, revocable, worldwide, royalty-free license for personal and commercial use. Attribution is optional; modifications are allowed, but you're responsible for code maintenance. We're not liable for any loss or damage. For full terms, please visit pleasedontcode.com/termsandconditions. - Project: GPS Viewer - Source Code NOT compiled for: Arduino Nano - Source Code created on: 2025-11-07 17:48:18 ********* Pleasedontcode.com **********/ /****** SYSTEM REQUIREMENTS *****/ /****** SYSTEM REQUIREMENT 1 *****/ /* Show real time gps on map */ /****** END SYSTEM REQUIREMENTS *****/ /* START CODE */ #include #include #include // Define GPS serial pins const uint8_t GPS_RX_PIN = A2; const uint8_t GPS_TX_PIN = A3; // Define GSM serial pins const uint8_t GSM_RX_PIN = A0; const uint8_t GSM_TX_PIN = A1; // Instantiate GPS TinyGPSPlus gps; // Instantiate GSM SoftwareSerial gpsSerial(GPS_RX_PIN, GPS_TX_PIN); SoftwareSerial gsmSerial(GSM_RX_PIN, GSM_TX_PIN); Sim800L sim800L(gsmSerial.read(), gsmSerial.write()); // Variables to hold GPS data float latitude = 0.0; float longitude = 0.0; // Map URL template const String mapUrlTemplate = "https://maps.google.com/?q=%f,%f"; void setup() { Serial.begin(9600); gpsSerial.begin(9600); gsmSerial.begin(9600); delay(1000); // Initialize GSM module sim800L.begin(9600); // Initialize GPS // GPS does not require special init in TinyGPS++ } void loop() { // Read GPS Data while (gpsSerial.available() > 0) { gps.encode(gpsSerial.read()); } // If new GPS data is available if (gps.location.isUpdated()) { latitude = gps.location.lat(); longitude = gps.location.lng(); // Show the GPS coordinates Serial.print("Latitude: "); Serial.println(latitude, 6); Serial.print("Longitude: "); Serial.println(longitude, 6); // Show the map URL String mapUrl = String("https://maps.google.com/?q=") + latitude + "," + longitude; Serial.println("Map URL: "); Serial.println(mapUrl); } } /* END CODE */