Go Down

Topic: NEO-6M GPS Library (Read 275 times) previous topic - next topic

Power_Broker

In order to learn how to create a lightweight interface with GPS devices I wrote a library to work with my NEO-6M GPS module.

With this library you can set the baud, sample rate, turn on/off individual NMEA sentences, and parse NMEA data. The source code is hosted on GitHub here.

Please take a look, critique it (I can use the constructive criticism ;) ), and use it for your own projects if you want to.

Here is an example sketch that shows how to use the library:
Code: [Select]

#include "neo6mGPS.h"




neo6mGPS myGPS;




void setup()
{
  pinMode(13, OUTPUT);
  digitalWrite(13, HIGH);
 
  Serial.begin(115200);
  while(!Serial);
 
  myGPS.begin(Serial1);
}




void loop()
{
  if(myGPS.available())
  {
    Serial.print(myGPS.utc);       Serial.print(" | ");
    Serial.print(myGPS.navStatus); Serial.print(" | ");
    Serial.print(myGPS.lat);       Serial.print(" | ");
    Serial.print(myGPS.latDir);    Serial.print(" | ");
    Serial.print(myGPS.lon);       Serial.print(" | ");
    Serial.print(myGPS.lonDir);    Serial.print(" | ");
    Serial.print(myGPS.sog_knots); Serial.print(" | ");
    Serial.print(myGPS.cog_true);  Serial.print(" | ");
    Serial.println();
  }
}



"The desire that guides me in all I do is the desire to harness the forces of nature to the service of mankind."
   - Nikola Tesla

pert

Thanks for your contribution to the Arduino project Power_Broker!

What is the purpose of these lines of your example sketch?:
Code: [Select]
  pinMode(13, OUTPUT);
  digitalWrite(13, HIGH);

Power_Broker

What is the purpose of these lines of your example sketch?:
Code: [Select]
  pinMode(13, OUTPUT);
  digitalWrite(13, HIGH);

I use Teensy 3.5 boards that do not have power leds like normal Arduinos. To work around this, all of my sketches use the pin 13 led as a makeshift power led.
"The desire that guides me in all I do is the desire to harness the forces of nature to the service of mankind."
   - Nikola Tesla

pert

It seems unnecessary in the example even for the Teensy, since you're going to be able to tell it's on from the Serial Monitor output.

If you are going to leave them in the example, I recommend adding a comment to explain their purpose.

iamnotgenius

thank you for your library, I will try it soon !

Go Up