The TinyGPS++ library example UseCustomFields shows how to get particular data from the NEO 6M GPS.
But I think it still reads all the sentences. I have used the Ublox Ucenter utility to change which sentences are transmitted. Some other libraries (NeoGPS?) allows you to set which sentences are read.
Multiple libraries were found for "NeoGPS_cfg.h"
Used: \Arduino\libraries\NeoGPS-master
In file included from Documents\Arduino\libraries\NeoGPS-master\examples\ublox\ublox.ino:43:0:
\Arduino\libraries\NeoGPS-master\src/GPSport.h:160:12: fatal error: AltSoftSerial.h: No such file or directory
#include <AltSoftSerial.h> // <-- DEFAULT. Two specific pins required
^~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1
Error compiling for board Arduino Nano.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
#include <NeoGPS_cfg.h>
#include <ublox/ubxGPS.h>
#include <GPSport.h>
#include <Streamers.h>
//------------------------------------------------------------
// Check that the config files are set up properly
#ifndef NMEAGPS_DERIVED_TYPES
#error You must "#define NMEAGPS_DERIVED_TYPES" in NMEAGPS_cfg.h!
#endif
#if !defined(UBLOX_PARSE_STATUS) & !defined(UBLOX_PARSE_TIMEGPS) & \
!defined(UBLOX_PARSE_TIMEUTC) & !defined(UBLOX_PARSE_POSLLH) & \
!defined(UBLOX_PARSE_DOP) & !defined(UBLOX_PARSE_PVT) & \
!defined(UBLOX_PARSE_VELNED) & !defined(UBLOX_PARSE_SVINFO) & \
!defined(UBLOX_PARSE_HNR_PVT)
#error No UBX binary messages enabled: no fix data available.
#endif
#ifndef NMEAGPS_RECOGNIZE_ALL
// Resetting the messages with ublox::configNMEA requires that
// all message types are recognized (i.e., the enum has all
// values).
#error You must "#define NMEAGPS_RECOGNIZE_ALL" in NMEAGPS_cfg.h!
#endif
//-----------------------------------------------------------------
// Derive a class to add the state machine for starting up:
// 1) The status must change to something other than NONE.
// 2) The GPS leap seconds must be received
// 3) The UTC time must be received
// 4) All configured messages are "requested"
// (i.e., "enabled" in the ublox device)
// Then, all configured messages are parsed and explicitly merged.
class MyGPS : public ubloxGPS
{
public:
enum
{
GETTING_STATUS,
GETTING_LEAP_SECONDS,
GETTING_UTC,
RUNNING
}
state NEOGPS_BF(8);
MyGPS( Stream *device ) : ubloxGPS( device )
{
state = GETTING_STATUS;
}
//--------------------------
void get_status()
{
static bool acquiring = false;
if (fix().status == gps_fix::STATUS_NONE) {
static uint32_t dotPrint;
bool requestNavStatus = false;
if (!acquiring) {
acquiring = true;
dotPrint = millis();
DEBUG_PORT.print( F("Acquiring...") );
requestNavStatus = true;
} else if (millis() - dotPrint > 1000UL) {
dotPrint = millis();
DEBUG_PORT << '.';
static uint8_t requestPeriod;
if ((++requestPeriod & 0x07) == 0)
requestNavStatus = true;
}
if (requestNavStatus)
// Turn on the UBX status message
enable_msg( ublox::UBX_NAV, ublox::UBX_NAV_STATUS );
} else {
if (acquiring)
DEBUG_PORT << '\n';
DEBUG_PORT << F("Acquired status: ") << (uint8_t) fix().status << '\n';
#if defined(GPS_FIX_TIME) & defined(GPS_FIX_DATE) & \
defined(UBLOX_PARSE_TIMEGPS)
if (!enable_msg( ublox::UBX_NAV, ublox::UBX_NAV_TIMEGPS ))
DEBUG_PORT.println( F("enable TIMEGPS failed!") );
state = GETTING_LEAP_SECONDS;
#else
start_running();
state = RUNNING;
#endif
}
} // get_status
//--------------------------
\Arduino\libraries\NeoGPS-master\src/GPSport.h:160:12: fatal error: AltSoftSerial.h: No such file or directory
#include <AltSoftSerial.h> // <-- DEFAULT. Two specific pins required
^~~~~~~~~~~~~~~~~
compilation terminated.
Multiple libraries were found for "NeoGPS_cfg.h"
Used: \Documents\Arduino\libraries\NeoGPS-master
Using library NeoGPS-master at version 4.2.9 in folder: \Documents\Arduino\libraries\NeoGPS-master
exit status 1
Error compiling for board Arduino Nano.
I've got NeoGPS working, after a lot of reading and googling.
I know that the author is a member of this forum and being a starter, I reaaally would like to ask him some questions. A lot of text that is quite stiff for a beginner, I wish I could delete 99% of it (and yes, that should be possible).
Bit afraid I messed up IDE by now by installing al those new libs.
BTW, is SDFat better than the standard SD support?
NEOGPS required a lot of reading to do some configurations in the config files. You have to manually enable/disable certain software serial ports etc. On the other hand, in the examples he uses quite a bit of advanced coding and since there are no tutorials to be found, it is hard.
SDFat is also hard to get. I am used to set my on Chipselect pin. It took me a while to find out that SDFat requires pin 10 to be CS. I cannot find where to change that.