I have a Seeeduino LoRawan GPS and cannot get the GPS to get a latitude/longitude fix. I tried the basic, unedited examples from the wiki for NEMA and Latitude/Longitude. It does get some information from the satellites (time, # of satellites) but not location. I left it in a window for 30 minutes and took it outside to an open area for 10 minutes with no results. Any suggestions?
NEMA sketch:
[code]
void setup()
{
Serial.begin(9600);
SerialUSB.begin(115200);
}
void loop()
{
while(Serial.available())
{
SerialUSB.write(Serial.read());
}
while(SerialUSB.available())
{
Serial.write(SerialUSB.read());
}
}
[/code]
Lat and Long Sketch:
[code]
#define USE_GPS 1
#include “LoRaWan.h”
#ifdef USE_GPS
#include “TinyGPS++.h”
TinyGPSPlus gps;
#endif
void setup(void)
{
char c;
#ifdef USE_GPS
bool locked;
#endif
SerialUSB.begin(115200);
while(!SerialUSB);
lora.init();
lora.setDeviceReset();
#ifdef USE_GPS
Serial.begin(9600); // open the GPS
locked = false;
// For S&G, let's get the GPS fix now, before we start running arbitary
// delays for the LoRa section
while (!gps.location.isValid()) {
while (Serial.available() > 0) {
if (gps.encode(c=Serial.read())) {
displayInfo();
if (gps.location.isValid()) {
// locked = true;
break;
}
}
// SerialUSB.print©;
}
// if (locked)
// break;
if (millis() > 15000 && gps.charsProcessed() < 10)
{
SerialUSB.println(F("No GPS detected: check wiring."));
SerialUSB.println(gps.charsProcessed());
while(true);
}
else if (millis() > 20000) {
SerialUSB.println(F("Not able to get a fix in alloted time."));
break;
}
}
#endif
}
void loop(void)
{
displayInfo();
delay(1000);
}
void displayInfo()
{
SerialUSB.print(F(“Location: “));
if (gps.location.isValid())
{
SerialUSB.print(gps.location.lat(), 6);
SerialUSB.print(F(”,”));
SerialUSB.print(gps.location.lng(), 6);
}
else
{
SerialUSB.print(F(“INVALID”));
}
SerialUSB.print(F(" Date/Time: “));
if (gps.date.isValid())
{
SerialUSB.print(gps.date.month());
SerialUSB.print(F(”/"));
SerialUSB.print(gps.date.day());
SerialUSB.print(F("/"));
SerialUSB.print(gps.date.year());
}
else
{
SerialUSB.print(F(“INVALID”));
}
SerialUSB.print(F(" “));
if (gps.time.isValid())
{
if (gps.time.hour() < 10) SerialUSB.print(F(“0”));
SerialUSB.print(gps.time.hour());
SerialUSB.print(F(”:"));
if (gps.time.minute() < 10) SerialUSB.print(F(“0”));
SerialUSB.print(gps.time.minute());
SerialUSB.print(F(":"));
if (gps.time.second() < 10) SerialUSB.print(F(“0”));
SerialUSB.print(gps.time.second());
SerialUSB.print(F("."));
if (gps.time.centisecond() < 10) SerialUSB.print(F(“0”));
SerialUSB.print(gps.time.centisecond());
}
else
{
SerialUSB.print(F(“INVALID”));
}
SerialUSB.println();
}
[/code]