I have the following code:
But firing the ShowData(); function does not have the desired effect. What could be the reason for this? I don't get the GPS coordinates...
Thanks in advance for the hints!
#include <TinyGPSPlus.h>
#include <SoftwareSerial.h>
static const int RXPin = 4, TXPin = 3;
static const uint32_t GPSBaud = 4800;
TinyGPSPlus gps;
SoftwareSerial ss(RXPin, TXPin);
void setup()
{
Serial.begin(115200);
ss.begin(GPSBaud);
}
char buffer[25];
void showData()
{
if (gps.location.isValid() && (gps.location.age() < 2000))
{
sprintf(buffer, "LATITUDE-%f", gps.location.lat());
Serial.println(buffer);
sprintf(buffer, "LONGITUDE-%f", gps.location.lng());
Serial.println(buffer);
}
if (millis() > 5000 && gps.charsProcessed() < 10)
{
Serial.println(F("No GPS detected: check wiring."));
while(true);
}
}
But firing the ShowData(); function does not have the desired effect. What could be the reason for this? I don't get the GPS coordinates...
Thanks in advance for the hints!