I have an Arduino Pro Mini along with a GPS Unit - ATGM336H. Below is the sketch I'm currently using:
#include <SoftwareSerial.h>
#include "Ublox.h"
SoftwareSerial GPS(4,5);
Ublox serial_gps;
void setup(){
Serial.begin(9600);
GPS.begin(9600);
}
void loop(){
while(GPS.available()){
char c = GPS.read();
if(serial_gps.encode(c)){
Serial.println(serial_gps.longitude);
}
}
}
I'm able to receive NMEA stream from the GPS Unit and parse (tried TinyGPS++, TinyGPS and Ublox) the stream but the data is not valid nor does it ever change. I've read that this GPS unit can take up to 32 seconds to get a fixed position and deliver valid co-ords but I cannot receive any.
Is there anything obviously wrong with my sketch or hardware setup?
Any and all help would be greatly appreciated!
if(serial_gps.encode(c)){ Serial.println(serial_gps.longitude); }
.... instead, useSerial.println(c);
to see if there is any actual data ...... I think that you are sending individual characters togps.encode()
, so you get nothing back