Publish speed with asset tracker

I have successfully gotten the assets tracker to publish lat, lon and battery. I cannot figure out speed. In the library for assettracker. h I see “gps.speed” and “getspeed”. I cannot find any examples of anyone that has used any speed variables or functions. I am some what new to the platform. I am using the gps functions example with some of the wake on motion. If any one has any ideas, please share, thank you

What have you tried? There’s only the one speed function, getSpeed(). Using it shouldn’t be any different than using readLat() or readLon(), so try putting it in your code, and if it doesn’t work, come back with a specific question and the results of your test.

1 Like

Would that be t.getSpeed()? And would that be knots or MPH?

Assuming that “t” is your instance of the Tracker object, then yes.

I have no idea, could be furlongs per fortnight for all I know :wink: I assume it’s documented in the library somewhere (I don’t have an Asset Tracker, so I’ve never used it).

I looked in all the libraries, I thought i had seen something in adafruitGPS that said it was in Knots, I tried it out and it seemed to be a little off. So, speedKnots = t.getSpeed(); // speedKnots needs to be a float variable
speedMph = speedKnots * 1.1507; ( i think that was the right conversion).
Thank you for all the help. All the examples online have helped tremendously.
Do you know if there is still a time out for connection to the electron? Meaning do I need to send something every 23 minutes to keep an active connection?

If your code is not doing that actively, the default/implicit Particle.keepAlive(23*60) will take care of the regular pings.

For the speed thing, I’d suggest going for the AssetTrackerRK library which uses the TinyGPS++ library which has some support for different units builtin.