Can anyone please help me with the following sketch that uses an EM406 GPS module & an Arduino UNO.
I am not getting any data from the GPS. I am trying to get current latitude & longitude readings, and to see them on the serial monitor.
Thanks.
#include <NewSoftSerial.h>
#include <nmea.h>
#undef round
// create a GPS data connection to GPRMC sentence type
NMEA gps(GPRMC);
NewSoftSerial nss(2, 3);
void setup()
{
Serial.begin(115200);
nss.begin(4800);
}
void loop()
{
if (Serial.available() > 0 ) {
// read incoming character from GPS
char c = Serial.read();
// check if the character completes a valid GPS sentence
if (gps.decode(c)) {
// check if GPS positioning was active
if (gps.gprmc_status() == ‘A’) {
Serial.print("Home lat: "); Serial.print(gps.gprmc_latitude());
Serial.print("Home lon: "); Serial.print(gps.gprmc_longitude());
}
}
}
}