Esp32 and Gps Neo 6m Firebase

Hello, can anyone help me to solve the problem with my project, namely Esp32 and Gps Neo 6m Firebase?

Following Programs:
#include <FirebaseESP32.h>
#include <WiFi.h>
#include <HardwareSerial.h>
#include <TinyGPS++.h>

#define FIREBASE_HOST ""
#define FIREBASE_AUTH ""
#define WIFI_SSID ""
#define WIFI_PASSWORD ""

FirebaseData firebaseData;
FirebaseJson json;

const int RXPin = 5; // D5 on ESP32
const int TXPin = 4; // D4 on ESP32
HardwareSerial neo6m(1); // Use Serial1 for ESP32
TinyGPSPlus gps;

void setup() {
Serial.begin(115200);
neo6m.begin(9600, SERIAL_8N1, RXPin, TXPin);
wifiConnect();

Serial.println("Connecting Firebase.....");
Firebase.reconnectWiFi(true);
Serial.println("Firebase OK.");
}

void loop() {
smartdelay_gps(1000);

if (gps.location.isValid()) {
float latitude = gps.location.lat();
float longitude = gps.location.lng();

if (Firebase.setFloat(firebaseData, "/GPS/f_latitude", latitude)) {
  print_ok();
} else {
  print_fail();
}

if (Firebase.setFloat(firebaseData, "/GPS/f_longitude", longitude)) {
  print_ok();
} else {
  print_fail();
}

} else {
Serial.println("No valid GPS data found.");
}

delay(10000);
}

static void smartdelay_gps(unsigned long ms) {
unsigned long start = millis();
do {
while (neo6m.available()) {
gps.encode(neo6m.read());
}
} while (millis() - start < 3000);
}

void wifiConnect() {
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
Serial.print("Connecting to Wi-Fi");
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(300);
}
Serial.println();
Serial.print("Connected with IP: ");
Serial.println(WiFi.localIP());
Serial.println();
}

void print_ok() {
Serial.println("------------------------------------");
Serial.println("OK");
Serial.println("PATH: " + firebaseData.dataPath());
Serial.println("TYPE: " + firebaseData.dataType());
Serial.println("ETag: " + firebaseData.ETag());
Serial.println("------------------------------------");
Serial.println();
}

void print_fail() {
Serial.println("------------------------------------");
Serial.println("FAILED");
Serial.println("REASON: " + firebaseData.errorReason());
Serial.println("------------------------------------");
Serial.println();
}

Hello, do yourself a favour and please read How to get the best out of this forum and modify your post accordingly (including code tags and necessary documentation for your ask).

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.