Interfacing an Altimeter that has Serial Output

CrossRoads' code is a good start, but it won't work. The data isn't a fixed 3 column field; you'll need to be able to deal with varying length numbers.

Here's some code I wrote that reads positive integers.

#define isdigit(X) (((X) >= '0') && ((X) <= '9')

int read_int()
{
  static byte c;
  static int i;

  i = 0;
  while (1)
  {
    while (!Serial.available())
    {;}
 
    c = Serial.read();
    Serial.print(c, BYTE);
  
    if (c == '\r')
    {
      return i;
    }
    if (isdigit(c))
    {
      i = i * 10 + c - '0';
    }
    else
    {
      Serial.print("\r\nERROR: \"");
      Serial.print(c, BYTE);
      Serial.print("\" is not a digit\r\n");
      return -1;
    }
  }
}

Hopefully the stratologger doesn't throw commas in there when you get >10,000'...

-j