Go Down

Topic: TinyGPS++ library (Read 1 time) previous topic - next topic


Hello, I'm having a lot of trouble using the TinyGPS++ library with the MKR GSM 1400. I understand that the MKR does not have software serial capabilities so I've been trying to get the library to work using hardware serial. Here is my code, but when I connect it properly I don't get output. I tested it with a Nano and it worked:
Code: [Select]

#include <TinyGPS++.h>

//Initialize TinyGPS++ object
TinyGPSPlus gps;

void setup() {
  //while (!Serial);

void loop() {
  while (Serial.available() > 0)
    if (gps.encode(Serial.read()))
      if (gps.location.isValid())
        Serial.print(gps.location.lat(), 6);
        Serial.print(", ");
        Serial.print(gps.location.lng(), 6);
        delay (1000);


If you are using the TX/RX pins on the headers, you must use Serial1 instead of Serial. Serial is for the USB serial.

Go Up