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.
krupalimistry:
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.
With TinyGPS++ what you suggest is quite easy, you wait for an update using the method;
gps.location.isUpdated()
Then go away for 30 seconds before you check again.
However what you are actually trying to do is not clear, I suspect you may be wanting to control the update rate of the GPS itself for reasons not explained.
TinyGPS++ has no functions for configureing the GPS itself as these functions would be specific to each type\manufacturer of GPS and TinyGPS++ (fortunatley) is not tied to being used with specific GPSs.
The library does not offer that, so You need to find the right sentence for your gps and just print it out as @jremington said
Your gps is attached to your serial port and can be configured by sending properly formatted commands. That’s what this was doing
gps.send_P( &gpsPort, F("PMTK220,30000") ); //update 1time in 30s
the command that is sent on the serial port looks like this [color=blue][color=red]$[/color]PMTK220,30000[color=red]*1D\r\n[/color][/color] the red parts were added by the send method (the end piece is in the send_trailer() function, 1D is the CRC)
krupalimistry:
gps.send_P( &gpsPort, F("PMTK220,30000") ); //update 1time in 30s
Note that is a config command specific for a GlobalTop\mediatek GPS. Some models are limited to a max updtate time of 1s and some to 10s, which one do you have that allows 30s ?