Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
NMEA decoder and Airbot UBlox GPS working on Arduino Pro Mini 3.3V
#include <nmea.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); // RX, TX - change for your connections
NMEA nmeaDecoder(ALL);
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(57600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// set the data rate for the SoftwareSerial port
mySerial.begin(9600); // UBlox data rate is low by default
}
void loop() // run over and over
{
if (mySerial.available()) {
if (nmeaDecoder.decode(mySerial.read())) {
Serial.print("Lon: ");
Serial.print(nmeaDecoder.gprmc_longitude());
Serial.print(", Lat: ");
Serial.print(nmeaDecoder.gprmc_latitude());
Serial.print(", Speed: ");
Serial.print(nmeaDecoder.gprmc_speed(KMPH));
Serial.print(", Course: ");
Serial.println(nmeaDecoder.gprmc_course());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.