Updating examples: change class name & update header file
This commit is contained in:
@@ -28,8 +28,8 @@
|
||||
|
||||
#include <Wire.h> //Needed for I2C to GNSS
|
||||
|
||||
#include <SparkFun_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||
SFE_UBLOX_GPS myGPS;
|
||||
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||
SFE_UBLOX_GNSS myGNSS;
|
||||
|
||||
void setup()
|
||||
{
|
||||
@@ -39,95 +39,95 @@ void setup()
|
||||
|
||||
Wire.begin();
|
||||
|
||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
||||
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);
|
||||
}
|
||||
|
||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||
myGPS.setNavigationFrequency(2); //Produce two solutions per second
|
||||
myGPS.setAutoPVT(true); //Tell the GNSS to "send" each solution
|
||||
//myGPS.saveConfiguration(); //Optional: Save the current settings to flash and BBR
|
||||
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||
myGNSS.setNavigationFrequency(2); //Produce two solutions per second
|
||||
myGNSS.setAutoPVT(true); //Tell the GNSS to "send" each solution
|
||||
//myGNSS.saveConfiguration(); //Optional: Save the current settings to flash and BBR
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
// Calling getPVT returns true if there actually is a fresh navigation solution available.
|
||||
// Start the reading only when valid LLH is available
|
||||
if (myGPS.getPVT() && (myGPS.getInvalidLlh() == false))
|
||||
if (myGNSS.getPVT() && (myGNSS.getInvalidLlh() == false))
|
||||
{
|
||||
Serial.println();
|
||||
long latitude = myGPS.getLatitude();
|
||||
long latitude = myGNSS.getLatitude();
|
||||
Serial.print(F("Lat: "));
|
||||
Serial.print(latitude);
|
||||
|
||||
long longitude = myGPS.getLongitude();
|
||||
long longitude = myGNSS.getLongitude();
|
||||
Serial.print(F(" Long: "));
|
||||
Serial.print(longitude);
|
||||
Serial.print(F(" (degrees * 10^-7)"));
|
||||
|
||||
long altitude = myGPS.getAltitude();
|
||||
long altitude = myGNSS.getAltitude();
|
||||
Serial.print(F(" Alt: "));
|
||||
Serial.print(altitude);
|
||||
Serial.print(F(" (mm)"));
|
||||
|
||||
byte SIV = myGPS.getSIV();
|
||||
byte SIV = myGNSS.getSIV();
|
||||
Serial.print(F(" SIV: "));
|
||||
Serial.print(SIV);
|
||||
|
||||
int PDOP = myGPS.getPDOP();
|
||||
int PDOP = myGNSS.getPDOP();
|
||||
Serial.print(F(" PDOP: "));
|
||||
Serial.print(PDOP);
|
||||
Serial.print(F(" (10^-2)"));
|
||||
|
||||
int nedNorthVel = myGPS.getNedNorthVel();
|
||||
int nedNorthVel = myGNSS.getNedNorthVel();
|
||||
Serial.print(F(" VelN: "));
|
||||
Serial.print(nedNorthVel);
|
||||
Serial.print(F(" (mm/s)"));
|
||||
|
||||
int nedEastVel = myGPS.getNedEastVel();
|
||||
int nedEastVel = myGNSS.getNedEastVel();
|
||||
Serial.print(F(" VelE: "));
|
||||
Serial.print(nedEastVel);
|
||||
Serial.print(F(" (mm/s)"));
|
||||
|
||||
int nedDownVel = myGPS.getNedDownVel();
|
||||
int nedDownVel = myGNSS.getNedDownVel();
|
||||
Serial.print(F(" VelD: "));
|
||||
Serial.print(nedDownVel);
|
||||
Serial.print(F(" (mm/s)"));
|
||||
|
||||
int verticalAccEst = myGPS.getVerticalAccEst();
|
||||
int verticalAccEst = myGNSS.getVerticalAccEst();
|
||||
Serial.print(F(" VAccEst: "));
|
||||
Serial.print(verticalAccEst);
|
||||
Serial.print(F(" (mm)"));
|
||||
|
||||
int horizontalAccEst = myGPS.getHorizontalAccEst();
|
||||
int horizontalAccEst = myGNSS.getHorizontalAccEst();
|
||||
Serial.print(F(" HAccEst: "));
|
||||
Serial.print(horizontalAccEst);
|
||||
Serial.print(F(" (mm)"));
|
||||
|
||||
int speedAccEst = myGPS.getSpeedAccEst();
|
||||
int speedAccEst = myGNSS.getSpeedAccEst();
|
||||
Serial.print(F(" SpeedAccEst: "));
|
||||
Serial.print(speedAccEst);
|
||||
Serial.print(F(" (mm/s)"));
|
||||
|
||||
int headAccEst = myGPS.getHeadingAccEst();
|
||||
int headAccEst = myGNSS.getHeadingAccEst();
|
||||
Serial.print(F(" HeadAccEst: "));
|
||||
Serial.print(headAccEst);
|
||||
Serial.print(F(" (degrees * 10^-5)"));
|
||||
|
||||
if (myGPS.getHeadVehValid() == true) {
|
||||
int headVeh = myGPS.getHeadVeh();
|
||||
if (myGNSS.getHeadVehValid() == true) {
|
||||
int headVeh = myGNSS.getHeadVeh();
|
||||
Serial.print(F(" HeadVeh: "));
|
||||
Serial.print(headVeh);
|
||||
Serial.print(F(" (degrees * 10^-5)"));
|
||||
|
||||
int magDec = myGPS.getMagDec();
|
||||
int magDec = myGNSS.getMagDec();
|
||||
Serial.print(F(" MagDec: "));
|
||||
Serial.print(magDec);
|
||||
Serial.print(F(" (degrees * 10^-2)"));
|
||||
|
||||
int magAcc = myGPS.getMagAcc();
|
||||
int magAcc = myGNSS.getMagAcc();
|
||||
Serial.print(F(" MagAcc: "));
|
||||
Serial.print(magAcc);
|
||||
Serial.print(F(" (degrees * 10^-2)"));
|
||||
|
||||
+12
-12
@@ -29,8 +29,8 @@
|
||||
|
||||
#include <Wire.h> //Needed for I2C to GNSS
|
||||
|
||||
#include <SparkFun_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||
SFE_UBLOX_GPS myGPS;
|
||||
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||
SFE_UBLOX_GNSS myGNSS;
|
||||
|
||||
void setup()
|
||||
{
|
||||
@@ -41,17 +41,17 @@ void setup()
|
||||
|
||||
Wire.begin();
|
||||
|
||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
||||
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)
|
||||
;
|
||||
}
|
||||
|
||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||
myGPS.setNavigationFrequency(2); //Produce two solutions per second
|
||||
myGPS.setAutoPVT(true, false); //Tell the GNSS to "send" each solution and the lib not to update stale data implicitly
|
||||
//myGPS.saveConfiguration(); //Optional: Save the current settings to flash and BBR
|
||||
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||
myGNSS.setNavigationFrequency(2); //Produce two solutions per second
|
||||
myGNSS.setAutoPVT(true, false); //Tell the GNSS to "send" each solution and the lib not to update stale data implicitly
|
||||
//myGNSS.saveConfiguration(); //Optional: Save the current settings to flash and BBR
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -73,21 +73,21 @@ void loop()
|
||||
if (counter % 500 == 0)
|
||||
{
|
||||
Serial.println();
|
||||
long latitude = myGPS.getLatitude();
|
||||
long latitude = myGNSS.getLatitude();
|
||||
Serial.print(F("Lat: "));
|
||||
Serial.print(latitude);
|
||||
|
||||
long longitude = myGPS.getLongitude();
|
||||
long longitude = myGNSS.getLongitude();
|
||||
Serial.print(F(" Long: "));
|
||||
Serial.print(longitude);
|
||||
Serial.print(F(" (degrees * 10^-7)"));
|
||||
|
||||
long altitude = myGPS.getAltitude();
|
||||
long altitude = myGNSS.getAltitude();
|
||||
Serial.print(F(" Alt: "));
|
||||
Serial.print(altitude);
|
||||
Serial.print(F(" (mm)"));
|
||||
|
||||
byte SIV = myGPS.getSIV();
|
||||
byte SIV = myGNSS.getSIV();
|
||||
Serial.print(F(" SIV: "));
|
||||
Serial.print(SIV);
|
||||
|
||||
@@ -96,7 +96,7 @@ void loop()
|
||||
// call checkUblox all 50ms to capture the GNSS data
|
||||
if (counter % 50 == 0)
|
||||
{
|
||||
myGPS.checkUblox();
|
||||
myGNSS.checkUblox();
|
||||
}
|
||||
delay(1);
|
||||
counter++;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
*/
|
||||
|
||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||
SFE_UBLOX_GPS myGPS;
|
||||
SFE_UBLOX_GNSS myGNSS;
|
||||
|
||||
#include <SoftwareSerial.h>
|
||||
|
||||
@@ -49,16 +49,16 @@ void setup()
|
||||
|
||||
mySerial.begin(baudRate); // Start the Serial port
|
||||
|
||||
if (myGPS.begin(mySerial) == false) //Connect to the u-blox module using Serial
|
||||
if (myGNSS.begin(mySerial) == false) //Connect to the u-blox module using Serial
|
||||
{
|
||||
Serial.println(F("u-blox GNSS not detected. Please check wiring. Freezing."));
|
||||
while (1);
|
||||
}
|
||||
|
||||
myGPS.setUART1Output(COM_TYPE_UBX); //Set the UART1 port to output UBX only (turn off NMEA noise)
|
||||
myGPS.setNavigationFrequency(2); //Produce two solutions per second
|
||||
myGPS.setAutoPVT(true); //Tell the GNSS to "send" each solution
|
||||
//myGPS.saveConfiguration(); //Optional: Save the current settings to flash and BBR
|
||||
myGNSS.setUART1Output(COM_TYPE_UBX); //Set the UART1 port to output UBX only (turn off NMEA noise)
|
||||
myGNSS.setNavigationFrequency(2); //Produce two solutions per second
|
||||
myGNSS.setAutoPVT(true); //Tell the GNSS to "send" each solution
|
||||
//myGNSS.saveConfiguration(); //Optional: Save the current settings to flash and BBR
|
||||
}
|
||||
|
||||
void loop()
|
||||
@@ -68,25 +68,25 @@ void loop()
|
||||
// to prevent serial buffer overflows on boards like the original RedBoard / UNO.
|
||||
// At 38400 Baud, the 100 PVT bytes will arrive in 26ms.
|
||||
// On the RedBoard, we need to call getPVT every 5ms to keep up.
|
||||
if (myGPS.getPVT())
|
||||
if (myGNSS.getPVT())
|
||||
{
|
||||
Serial.println();
|
||||
|
||||
long latitude = myGPS.getLatitude();
|
||||
long latitude = myGNSS.getLatitude();
|
||||
Serial.print(F("Lat: "));
|
||||
Serial.print(latitude);
|
||||
|
||||
long longitude = myGPS.getLongitude();
|
||||
long longitude = myGNSS.getLongitude();
|
||||
Serial.print(F(" Long: "));
|
||||
Serial.print(longitude);
|
||||
Serial.print(F(" (degrees * 10^-7)"));
|
||||
|
||||
long altitude = myGPS.getAltitude();
|
||||
long altitude = myGNSS.getAltitude();
|
||||
Serial.print(F(" Alt: "));
|
||||
Serial.print(altitude);
|
||||
Serial.print(F(" (mm)"));
|
||||
|
||||
byte SIV = myGPS.getSIV();
|
||||
byte SIV = myGNSS.getSIV();
|
||||
Serial.print(F(" SIV: "));
|
||||
Serial.print(SIV);
|
||||
|
||||
|
||||
+8
-8
@@ -30,7 +30,7 @@
|
||||
*/
|
||||
|
||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||
SFE_UBLOX_GPS myGPS;
|
||||
SFE_UBLOX_GNSS myGNSS;
|
||||
|
||||
#include <SoftwareSerial.h>
|
||||
|
||||
@@ -52,11 +52,11 @@ void setup()
|
||||
//Assume that the U-Blox GNSS is running at baudRate baud
|
||||
mySerial.begin(baudRate);
|
||||
// No need to check return value as internal call to isConnected() will not succeed
|
||||
myGPS.begin(mySerial);
|
||||
myGNSS.begin(mySerial);
|
||||
|
||||
// Tell the library we are expecting the module to send PVT messages by itself to our Rx pin.
|
||||
// You can set second parameter to "false" if you want to control the parsing and eviction of the data (need to call checkUblox cyclically)
|
||||
myGPS.assumeAutoPVT(true, true);
|
||||
myGNSS.assumeAutoPVT(true, true);
|
||||
|
||||
}
|
||||
|
||||
@@ -71,25 +71,25 @@ void loop()
|
||||
// to prevent serial buffer overflows on boards like the original RedBoard / UNO.
|
||||
// At 38400 Baud, the 100 PVT bytes will arrive in 26ms.
|
||||
// On the RedBoard, we need to call getPVT every 5ms to keep up.
|
||||
if (myGPS.getPVT())
|
||||
if (myGNSS.getPVT())
|
||||
{
|
||||
Serial.println();
|
||||
|
||||
long latitude = myGPS.getLatitude();
|
||||
long latitude = myGNSS.getLatitude();
|
||||
Serial.print(F("Lat: "));
|
||||
Serial.print(latitude);
|
||||
|
||||
long longitude = myGPS.getLongitude();
|
||||
long longitude = myGNSS.getLongitude();
|
||||
Serial.print(F(" Long: "));
|
||||
Serial.print(longitude);
|
||||
Serial.print(F(" (degrees * 10^-7)"));
|
||||
|
||||
long altitude = myGPS.getAltitude();
|
||||
long altitude = myGNSS.getAltitude();
|
||||
Serial.print(F(" Alt: "));
|
||||
Serial.print(altitude);
|
||||
Serial.print(F(" (mm)"));
|
||||
|
||||
byte SIV = myGPS.getSIV();
|
||||
byte SIV = myGNSS.getSIV();
|
||||
Serial.print(F(" SIV: "));
|
||||
Serial.print(SIV);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user