SerialNMEAtoUSB

There are two versions.  The first is here, and the second begins with SECOND.
SerialNMEAtoUSB_nosensor_trigger

/*
  AnalogReadSerial
  Reads an analog input on pin 0, prints the result to the serial monitor.
  Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.
 
 This example code is in the public domain.
 */
#include <Wire.h>
//#include <LSM303.h>

//LSM303 compass;
int inByte;
char msg[100];
int charcount=0;
char mymsg[]="$GPRMC,";
int msgcount=0;
char matching=0;
char rmc=0;
char tomatch[]="00";

// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
  Serial2.begin(9600);
}

// the loop routine runs over and over again forever:
void loop() {
  // read the input on analog pin 0:
  int sensorValue = analogRead(A0);
  // read from port 2, send to port 0:
  if (Serial2.available()) {
    inByte = Serial2.read();
    Serial.write(inByte); 
    
    if (inByte==10) {
      charcount=0;
      msgcount=0;
      matching=0;
      rmc=0;
    } else if (rmc==1){
      if (charcount<4){
        charcount++;
        //clear output pin
      } else if (inByte==tomatch[charcount-4]) {
        charcount++;
        if (charcount==7) {
          //set output pin
          matching==0; //stop testing
        }
      } else {
        matching=0;
        rmc=0;
      }      
    } else if (inByte==mymsg[msgcount]) {
      matching=1;
      msgcount++;
      if msgcount==6 {
        rmc=1;
      }
    } 
  }

}

SECOND VERSION SerialNMEAtoUSB
/*
  AnalogReadSerial
  Reads an analog input on pin 0, prints the result to the serial monitor.
  Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.
 
 This example code is in the public domain.
 */
#include <Wire.h>
#include <LSM303.h>

LSM303 compass;
int inByte;

// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
  Serial2.begin(9600);
  Wire.begin();
  compass.init();
  compass.enableDefault();
}

// the loop routine runs over and over again forever:
void loop() {
  // read the input on analog pin 0:
  int sensorValue = analogRead(A0);
  // read from port 2, send to port 0:
  if (Serial2.available()) {
    inByte = Serial2.read();
    Serial.write(inByte); 
    if (inByte==10) {
        compass.read();
        Serial.print("A ");
        Serial.print("X: ");
        Serial.print((int)compass.a.x);
        Serial.print(" Y: ");
        Serial.print((int)compass.a.y);
        Serial.print(" Z: ");
        Serial.print((int)compass.a.z);

        Serial.print(" M ");  
        Serial.print("X: ");
        Serial.print((int)compass.m.x);
        Serial.print(" Y: ");
        Serial.print((int)compass.m.y);
        Serial.print(" Z: ");
        Serial.println((int)compass.m.z);
    }
  }
  // print out the value you read:
//  Serial.println(sensorValue);
//  delay(1);        // delay in between reads for stability
}