GPS: set update frequency

For some reason, I missed this thread. Here's a little thing I whipped up to configure my SKM53. NOte the usage in the first comment, which tells you that you enter the line from $ to *, inclusive. The checksum will be calculated for you.

/*
Enter a packet starting with $PMTK, and ending with a *
In this sketch the * indicates the end of transmission.
The sketch takes the packet, adds a checksum and sends it to
the GPS.

Note: If you change the baud rate of the GPS, you will have to
close the Serial monitor, change the baud rate in Serial1
(or whatever Serial port you use) and restart it.

Set your Serial Monitor to No Line Endings. The sketch supplies those too,
and if you send them, they will get you out of sync.

This sketch assumes you are running an Arduino Mega2560, and
have a serial GPS on Serial1. Change this to suit your own
configuration. (Software Serial for Uno, etc.)

One packet type not mentioned in the document at
http://api.ning.com/files/L30xp1HTxtEUhhmBj4yYWIB31IDKs*xJNecJYvcEKZofuHJcZ3wnTMuZL5FeJC535I6DJbBZZE7FpJwnQPxgT9yKLCibZaZj/NMEA_Packet_Userl.pdf
is packet type 220. Here are a couple of samples, as you
would enter them into the Serial Monitor

$PMTK220,200*
$PMTK220,500*
$PMTK220,1000*
$PMTK220,2000*

These will set the reporting interval to 200, 500, 1000,
and 2000 milliseconds, or 5, 2, 1, .5 Hz,  respectively.
*/

char sentence[80];
int idx = 0;

void setup() {
  // initialize both serial ports:
  Serial.begin(57600);
  Serial1.begin(9600);
}

void loop() {
  // read from Serial1, send to Serial:
  if (Serial1.available()) {
    Serial.write(Serial1.read());
  }

  if (Serial.available())  {
    char inbyte = Serial.read();
    sentence[idx++] = inbyte;
    sentence[idx] = 0;
    if (inbyte == '*') {
      for (int i=0; i < strlen(sentence); i++) {
        Serial.print(sentence[i]);
      }
      Serial.println();
      sendConfig ();
      sentence[0] = 0;
      idx = 0;
    }
  }
}

void sendConfig () {
  unsigned char CS = 0;
  for (int i=1; i< strlen(sentence)-1; i++) {
    CS ^= sentence[i];
  }
  Serial1.print(sentence);
  if (CS < 10) Serial1.print("0");
  Serial1.print(CS,HEX);
  Serial1.println();
}