#include <HardwareSerial.h>
#include <Wire.h>
HardwareSerial GPS(1); // Using hardware serial port 1 for GPS simulation
void setup() {
Serial.begin(115200); // Initialize serial communication with the PC
GPS.begin(9600, SERIAL_8N1, 16, 17); // RX = GPIO16, TX = GPIO17
Serial.println("GPS Tracking Simulation Started");
}
void loop() {
// Simulate GPS data
float latitude = random(3000, 4000) / 100.0; // Random latitude for simulation
float longitude = random(7000, 8000) / 100.0; // Random longitude for simulation
// Simulate sending data to ESP32
GPS.print("Latitude: ");
GPS.println(latitude, 6);
GPS.print("Longitude: ");
GPS.println(longitude, 6);
// Read the simulated data from GPS
if (GPS.available()) {
String data = GPS.readStringUntil('\n');
Serial.println(data); // Display the data on the serial monitor
}
delay(1000); // Update every second
}