with library v2 if you use Arduino cloud, all coordinates are inaccurate.
To replicate problem with mkr nb 1500:
file.ino
#include <MKRNB.h>
#include <Wire.h> //Needed for I2C to GNSS
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
SFE_UBLOX_GNSS myGNSS;
#include "GPS.h"
void setup() {
// initialize serial communications and wait for port to open:
Serial.begin(115200);
while (!Serial){
;
}
Wire.begin();
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
{
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
while (1);
}
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
myGNSS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
initProperties();
//ArduinoCloud.begin(ArduinoIoTPreferredConnection, false); //uncomment this, everything breaks
setDebugMessageLevel(DBG_VERBOSE);
ArduinoCloud.printDebugInfo();
}
void loop() {
// read GPS values
long latitude = myGNSS.getLatitude();
Serial.print(latitude);
Serial.print(",");
long longitude = myGNSS.getLongitude();
Serial.print(longitude);
Serial.print(",");
long altitude = myGNSS.getAltitude();
Serial.println(altitude);
delay(1000);
}
GPS.h
// Code generated by Arduino IoT Cloud, DO NOT EDIT.
#include <ArduinoIoTCloud.h>
#include <Arduino_ConnectionHandler.h>
const char GPRS_APN[] = "SECRET_OPTIONAL_APN";
const char PINNUMBER[] = "SECRET_OPTIONAL_PIN";
const char GPRS_LOGIN[] = "SECRET_OPTIONAL_USERNAME";
const char GPRS_PASSWORD[] = "SECRET_OPTIONAL_PASSWORD";
void initProperties(){
}
NBConnectionHandler ArduinoIoTPreferredConnection(PINNUMBER, GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD);
this works, but moment you uncomment line 25,
//ArduinoCloud.begin(ArduinoIoTPreferredConnection, false);
The coordinates outputted by the library are completely wrong.
What can be done?