#include <HardwareSerial.h>
HardwareSerial GPS(1); // Use UART1 for GPS (TX: GPIO 17, RX: GPIO 16)
void setup() {
Serial.begin(115200); // Start the serial communication for debugging
GPS.begin(9600, SERIAL_8N1, 16, 17); // Initialize UART1 (TX: GPIO 17, RX: GPIO 16) for GPS communication
Serial.println("NEO-6M GPS with ESP32 Initialized");
}
void loop() {
if (GPS.available()) { // Check if there's any data coming from the GPS module
while (GPS.available()) {
char c = GPS.read(); // Read each character from GPS module
Serial.print(c); // Output the character to the Serial Monitor
}
} else {
Serial.println("Waiting for GPS data...");
delay(1000); // Wait for 1 second before checking again
}
}