mikalhart / TinyGPS

A compact Arduino NMEA (GPS) parsing library
http://arduiniana.org
387 stars 257 forks source link

distance_between function #6

Open varlux opened 8 years ago

varlux commented 8 years ago

Hi everybody. How do I use the function in object? Can I use the output of the function "gps.f_get_position(&flat, &flon, &fix_age)"

Thanks

Prince-of-Persia commented 7 years ago

You're passing pointers to the function f_get_position(...) from the Arduino sketch. This variables will be modified/writtento by the function which will become available to use in your sketch.

i.e. defined function:

void TinyGPS::f_get_position(float *latitude, float *longitude, unsigned long *fix_age)
{
  long lat, lon;
  get_position(&lat, &lon, fix_age);
  *latitude = lat == GPS_INVALID_ANGLE ? GPS_INVALID_F_ANGLE : (lat / 1000000.0);
  *longitude = lat == GPS_INVALID_ANGLE ? GPS_INVALID_F_ANGLE : (lon / 1000000.0);
}

call function from Arduino sketch:

gps.f_get_position(&flat, &flon, &fix_age);

after function call: flat = [some value] flon = [some value] fix_age = [some value]