Hello everyone,
Quick question for the more code savvy individuals on this site. I have a Neo -6m GPS module connected to an Arduino UNO. The problem I have is my Uno cannot "handle" both position data and time data at the same time. For example, I can serial print both latitude and longitude and the serial monitor will output the correct values. I can serial print both hour and minute and the serial monitor will output the correct values. But i cannot serial print latitude, longitude, hour, and minute at the same time. My serial monitor will output zeroes for each value. Here is the code I am using.
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
SoftwareSerial gpsSerial(3, 4); //rx,tx
TinyGPSPlus gps;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
gpsSerial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
while (gpsSerial.available() > 0) {
gps.encode(gpsSerial.read());
Serial.print(gps.location.lat());
Serial.print(" ");
Serial.println(gps.location.lng());
Serial.print(" ");
Serial.print(gps.time.hour());
Serial.print(" ");
Serial.println(gps.time.minute());
}
Serial.println("NO DATA");
}