The code included in the wiki is full of errors and wont even compile, does anyone have a working solution?
#include <TinyGPSPlus.h>
#include <SoftwareSerial.h>
/*
This sample sketch demonstrates how to use L76K GNSS Module on SeeedStudio XIAO.
*/
static const int RXPin = D7, TXPin = D6;
static const uint32_t GPSBaud = 9600;
// The TinyGPSPlus object
TinyGPSPlus gps;
// The serial connection to the GNSS module
SoftwareSerial ss(RXPin, TXPin);
void setup() {
Serial.begin(115200);
#ifdef ARDUINO_SEEED_XIAO_RP2040
pinMode(D10,OUTPUT);
digitalWrite(D10,1);
pinMode(D0,OUTPUT);
digitalWrite(D0,1);
#endif
ss.begin(GPSBaud);
Serial.println(F(“DeviceExample.ino”));
Serial.println(F(“A simple demonstration of TinyGPSPlus with L76K GNSS Module”));
Serial.print(F("Testing TinyGPSPlus library v. "));
Serial.println(TinyGPSPlus::libraryVersion());
Serial.println(F(“by Mikal Hart”));
Serial.println();
}
void loop() {
// This sketch displays information every time a new sentence is correctly encoded.
while (ss.available() > 0)
if (gps.encode(ss.read()))
displayInfo();
if (millis() > 5000 && gps.charsProcessed() < 10) {
Serial.println(F(“No GPS detected: check wiring.”));
while (true);
}
}
void displayInfo() {
Serial.print(F(“Location: “));
if (gps.location.isValid()) {
Serial.print(gps.location.lat(), 6);
Serial.print(F(”,”));
Serial.print(gps.location.lng(), 6);
} else {
Serial.print(F(“INVALID”));
}
Serial.print(F(" Date/Time: “));
if (gps.date.isValid()) {
Serial.print(gps.date.month());
Serial.print(F(”/"));
Serial.print(gps.date.day());
Serial.print(F("/"));
Serial.print(gps.date.year());
} else {
Serial.print(F(“INVALID”));
}
Serial.print(F(" “));
if (gps.time.isValid()) {
if (gps.time.hour() < 10) Serial.print(F(“0”));
Serial.print(gps.time.hour());
Serial.print(F(”:"));
if (gps.time.minute() < 10) Serial.print(F(“0”));
Serial.print(gps.time.minute());
Serial.print(F(":"));
if (gps.time.second() < 10) Serial.print(F(“0”));
Serial.print(gps.time.second());
Serial.print(F("."));
if (gps.time.centisecond() < 10) Serial.print(F(“0”));
Serial.print(gps.time.centisecond());
} else {
Serial.print(F(“INVALID”));
}
Serial.println();
}