Please help! Carloop GPS Issues

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!

Solved.

The code works, it was just a matter of getting jumper wires so you can place the gps unit on top of the dashboard and have the OBD still connected underneath the dashboard. It still takes a minute or so to receive GPS data.

That is great to hear. If you have a picture of your setup it might be helpful. I think @tmitchell is running into a similar issue.