Hello everyone, i have a NEO-6M GPS Module and using ESP - WROOM 32 for the microcontroller, and i cant seem to receive GPS data but i do have a Time and date received but it is all at default (Time - 0:0:0:0 ; Date - 0/0/2000) and for the GPS data, it only prints "Waiting for GPS Fix"
#include <TinyGPS++.h>
#define GPS_RX_PIN 16
#define GPS_TX_PIN 17
TinyGPSPlus gps;
HardwareSerial mySerial(1);
unsigned long previousMillis = 0;
const long interval = 1000;
void setup() {
Serial.begin(115200);
mySerial.begin(9600, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN);
Serial.println("GPS Display Started");
}
void loop() {
unsigned long currentMillis = millis();
while (mySerial.available()) {
char c = mySerial.read();
gps.encode(c);
}
if (currentMillis - previousMillis >= interval) {
previousMillis = currentMillis;
if (gps.location.isUpdated()) {
Serial.print("Latitude: ");
Serial.print(gps.location.lat(), 6);
Serial.print(" Longitude: ");
Serial.println(gps.location.lng(), 6);
} else {
Serial.println("Waiting for GPS fix...");
}
}
if (gps.date.isUpdated()) {
Serial.print("Date: ");
Serial.print(gps.date.month());
Serial.print("/");
Serial.print(gps.date.day());
Serial.print("/");
Serial.println(gps.date.year());
}
if (gps.time.isUpdated()) {
Serial.print("Time: ");
Serial.print(gps.time.hour());
Serial.print(":");
Serial.print(gps.time.minute());
Serial.print(":");
Serial.println(gps.time.second());
}
}