Hello,
I am working on getting real-time GPS coordinates using the [Carloop GPS Unit] (https://store.carloop.io/products/carloop-gps?variant=4846877966372). I have it connected to the Carloop OBD + Particle Electron and I can grab current car speed from CAN messages but the GPS is not valid for me.
The code I’m trying this with is basically:
auto &gps = carloop.gps();
WITH_LOCK(gps) {
if (gps.location.isValid()) {
float lat = gps.location.lat(); //get latitude and longitude
float lon = gps.location.lng();
slocation = String(lat) + "," + String(lon);
Serial.println(slocation);
}
else {
Serial.println("GPS not valid");
}
}
I can’t tell what I am doing wrong and I’ve been at this for several days. Perhaps it is something wrong with how I’m connecting the GPS unit to the rest of the OBD? Or the fact that the GPS unit is hidden underneath the wheel because it has to be a part of the OBD?
Any input or advice would be MUCH appreciated!