A library for Arduino
The library arises from the need to simplify the use of the module, using the NMEA standart.
It does not generate excess memory consumption, it is implemented with own functions to handle the pointers of the buffers.
CONSTRUCTORS | Notes |
---|---|
Gpsneo () | Rx , Tx and baudrate by default |
Gpsneo (rx, tx) | Rx and Tx set by user. Baudrate by default |
Gpsneo (rx, tx, baudrate) | Rx, Tx, baudrate set by user. |
Methods | Notes |
---|---|
Google (char *link) | Gives a link for google maps. |
getDataGPRMC () | To see the parameters look at the examples |
convertLongitude (char *longitude,char *destination) | Converts the longitude given by the read NMEA, to grades. |
convertLatitude (char *longitude,char *destination) | Converts the latitude given by the read NMEA, to grades. |
$GPRMC - Recommended minimum specific GPS/Transit data
an example of a normal sentence:
Info:
The knot (kn) is a unit of speed equal to one nautical mile (1.852 km) per hour, approximately 1.151 mph.
#include <SoftwareSerial.h>
#include <Gpsneo.h>
Gpsneo gps; // Call the contructor for the Class.
char time[10];
char status[2];
char latitud[15];
char latitudHemisphere[2];
char longitud[15];
char longitudMeridiano[15];
char speedKnots[10];
char trackAngle[8];
char date[10];
char magneticVariation[10];
char magneticVariationOrientation[2];
void setup()
{
Serial.begin(9600);
}
void loop()
{
//Just simple do getDataGPRMC, and the method solve everything.
gps.getDataGPRMC(
time,status, latitud, latitudHemisphere, longitud,
longitudMeridiano, speedKnots,trackAngle, date,
magneticVariation, magneticVariationOrientation
);
Serial.println(time);
Serial.println(status);
Serial.println(latitud);
Serial.println(latitudHemisphere);
Serial.println(longitud);
Serial.println(longitudMeridiano);
Serial.println(speedKnots);
Serial.println(trackAngle);
Serial.println(date);
Serial.println(magneticVariation);
Serial.println(magneticVariationOrientation);
}
#include <SoftwareSerial.h>
#include <Gpsneo.h>
Gpsneo gps;
char latitud[15];
char latitudHemisphere[2];
char longitud[15];
char longitudMeridiano[15];
void setup()
{
Serial.begin(9600);
}
void loop()
{
gps.getDataGPRMC(latitud,latitudHemisphere,longitud,longitudMeridiano);
Serial.println(latitud);
Serial.println(latitudHemisphere);
Serial.println(longitud);
Serial.println(longitudMeridiano);
}
This method provides a link to see the place on Google Maps.
Is very easy to use, only need to call the function with the parameter.
#include <SoftwareSerial.h>
#include <Gpsneo.h>
Gpsneo gps;
/*warning is too important that the
size of array don't be minor than they need!
*/
char link[60];
void setup()
{
Serial.begin(9600);
}
void loop()
{
gps.Google(link);
}
Serial Port Output:
http://www.google.com/maps/place/-34.9140170,-57.9377400
http://www.google.com/maps/place/-34.9140240,-57.9376560
http://www.google.com/maps/place/-34.9140240,-57.9376560
http://www.google.com/maps/place/-34.9140240,-57.9375800
http://www.google.com/maps/place/-34.9139980,-57.9376300
http://www.google.com/maps/place/-34.9139980,-57.9376300
...
...
...
The function is responsible for performing all the actions necessary to obtain the link. It must be taken into account that the realization of the reading weft, the obtained data corresponds to the protocol NMEA, so the latitud comes in the format ddmm.mmmmm, what is dd°mm'mmmm'', and for longitude in dddmm.mmm, ddd°mm'mmm'' therefore it is converted to dd.ddddd for Google Maps to understand this. The convertion of these units is obtained from another method of the library.