1

I am working with TinyGPS++ library and Arduino-nano and I want to change the update rate. I worked before with Adafruit GPS and uses the below code for updating it.

// Set the update rate
 GPS.sendCommand(PMTK_SET_NMEA_UPDATE_1HZ);   // 1 Hz update rate

I have also worked with NMEAGPS.h to update every 30sec.

gps.send_P( &gpsPort, F("PMTK220,30000") );        //update 1time in 30s

So how to change the upsate rate for TinyGPS++ library? as I want to update 1 time in 30seconds.

10
  • I looked at the source code and it appears that the library checks for a new complete sentance as fast as you call the method encode. From your question, it is not clear if this library is working too slow or too fast for your application. But it does appear your application is in charge of any desired delay.
    – st2000
    Commented Nov 29, 2020 at 15:34
  • @st2000 I just want an update after every 30second. Commented Nov 30, 2020 at 1:49
  • If your code does not need to do anything else, I'm thinking you can simply call delay milliseconds with 30000 each time in between calling encode(). If you would like to do other things during that time, then you need to implement a state machine.
    – st2000
    Commented Nov 30, 2020 at 1:53
  • can you explain with an example? Commented Nov 30, 2020 at 1:57
  • 1
    This example TinyGPS code appears to attempt to grab new GPS data once a second. Guessing, if you increase the loop counter on line 30 from 1000 to 30000, the delay will increase from once a second to once every 30 seconds.
    – st2000
    Commented Nov 30, 2020 at 4:29

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.