Basic EM-406A code

Hey guys. I’ve seen different code floating around for the EM-406A. I used the code provided on the Arduino site to interface with the Parallax receiver and stripped it down to just get the messages out. Here it is:

int rxPin = 0;                    // TX pin of EM-406A connected to RX pin of arduino
int charGPS;                      // stores each char received
char buff[100] = "";              // buffer to hold each NMEA message
int charCount=0;                  // count of chars received in each message

void setup() {
  pinMode(rxPin, INPUT);
  for (int i=0;i<100;i++){       // Initialize a buffer for received data
    buff[i]=' ';

void loop() {;         // Read a byte/char from serial port
  if (charGPS == -1) {           //  if received bytes == -1, byte not ready or not available
    delay(100);                  // delay 100ms for byte to come in 
  //if byte is a valid char, it is put in buffer 
  else {
    buff[charCount]=charGPS;        // If serial port data avail, put in buffer
    charCount++;                    //increase received char count  
    printByte(charGPS);             //print receive char

    // If the received char == 13, CR, end of NMEA message
    if (charGPS==13){            
      charCount=0;                    // reset the received char count
      for (int i=0;i<100;i++){        //clear buffer  
        buff[i]=' ';