Code Monkey home page Code Monkey logo

Comments (8)

fu-hsi avatar fu-hsi commented on August 22, 2024

Hi.
It's simple.

const char* time = fuGPS.getField(1);

You have also available public fields:

byte Hours, Minutes, Seconds;
byte Days, Months, Years; 

Example:
byte minutes = fuGPS.Minutes;

from fugps.

MeY0u avatar MeY0u commented on August 22, 2024

from fugps.

fu-hsi avatar fu-hsi commented on August 22, 2024

Sorry, but everything works on my side:

stream.print(String(fuGPS.Years) + "." + String(fuGPS.Months) + "." + String(fuGPS.Days));

Date is stored in RMC message.
Library needs at least one message of that type to parse date. Maybe your module is wrongly configured.

fuGPS.sendCommand(FUGPS_PMTK_API_SET_NMEA_OUTPUT_RMCGGA);

You can always check out demo programs to display detailed data or connect the module directly to the serial port and see what is being sent.

from fugps.

MeY0u avatar MeY0u commented on August 22, 2024

from fugps.

MeY0u avatar MeY0u commented on August 22, 2024
#include <FuGPS.h>
#define NMEA_RX1 44  
#define NMEA_TX1 43

FuGPS fuGPS(Serial1);
bool gpsAlive = false;

void setup()
{
    Serial.begin(115200);
    Serial1.begin(38400, SERIAL_8N1, NMEA_RX1, NMEA_TX1);

    fuGPS.sendCommand(FUGPS_PMTK_SET_NMEA_BAUDRATE_38400);
    // fuGPS.sendCommand(FUGPS_PMTK_SET_NMEA_UPDATERATE_1HZ);
    fuGPS.sendCommand(FUGPS_PMTK_API_SET_NMEA_OUTPUT_RMCGGA);
}

void loop()
{
    // Valid NMEA message
    if (fuGPS.read())
    {
        // We don't know, which message was came first (GGA or RMC).
        // Thats why some fields may be empty.

        gpsAlive = true;

        Serial.print("Quality: ");
        Serial.println(fuGPS.Quality);

        Serial.print("Satellites: ");
        Serial.println(fuGPS.Satellites);
        
        Serial.print("Date: ");
        Serial.println(fuGPS.Days);
        
        Serial.print("Month: ");
        Serial.println(fuGPS.Months);

        Serial.print("Year: ");
        Serial.println(fuGPS.Years);

        if (fuGPS.hasFix() == true)
        {
            // Data from GGA message
            Serial.print("Accuracy (HDOP): ");
            Serial.println(fuGPS.Accuracy);

            Serial.print("Altitude (above sea level): ");
            Serial.println(fuGPS.Altitude);


            // Data from GGA or RMC
            Serial.print("Location (decimal degrees): ");
            Serial.println("https://www.google.com/maps/search/?api=1&query=" + String(fuGPS.Latitude, 6) + "," + String(fuGPS.Longitude, 6));
        }
    }

    // Default is 10 seconds
    if (fuGPS.isAlive() == false)
    {
        if (gpsAlive == true)
        {
            gpsAlive = false;
            Serial.println("GPS module not responding with valid data.");
            Serial.println("Check wiring or restart.");
        }
    }
}

here is the code i am running and i dont receive date, everything(not including speed) but date

from fugps.

MeY0u avatar MeY0u commented on August 22, 2024

found the problem in the FuGPS library, the value of tokensCount should be compared to 14 and not 13

from fugps.

fu-hsi avatar fu-hsi commented on August 22, 2024

@MeY0u there is no problem with the library. RMC message has 13 tokens including message id:

https://aprs.gids.nl/nmea/#rmc

eg1. $GPRMC,081836,A,3751.65,S,14507.36,E,000.0,360.0,130998,011.3,E*62
eg2. $GPRMC,225446,A,4916.45,N,12311.12,W,000.5,054.7,191194,020.3,E*68
eg3. $GPRMC,220516,A,5133.82,N,00042.24,W,173.8,231.8,130694,004.2,W*70
              1    2    3    4    5     6    7    8      9     10  11 12

Perhaps your GPS module sending data out of standard. That's why it's better to display all incoming messages to analyze.

from fugps.

MeY0u avatar MeY0u commented on August 22, 2024

i use ATGM332D-5NR32 and i print the currentbuffer variable from the library and i didnt notice any difference between the standard and what i sends back.
all the tokens are at the correct index as you set it.

By the way, the library is pretty easy to modify, thats great bonus thank you.

from fugps.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.