Altimeter Module MS5607 w/ Arduino Mega 2560

I recently was able to connect and test the sample code for this Altimeter. I was having trouble with IDE 1.0.5, but none with 1.5.4 (Beta)

I was following the build specs on this site: http://learn.parallax.com/KickStart/29124
I downloaded the Arduino 1.0 Code for the Altimeter Module (First link for Arduino)
and then copied the code:

#include <Wire.h> 
#include "IntersemaBaro.h"

Intersema::BaroPressure_MS5607B baro(true);

void setup() { 
    Serial.begin(9600);
    baro.init();
}

void loop() {
  int alt = baro.getHeightCentiMeters();
  Serial.print("Centimeters: ");
  Serial.print((float)(alt));
  Serial.print(", Feet: ");
  Serial.println((float)(alt) / 30.48);
  delay(400);
}

My question is, How can I find the functions to call for (acquire a library I’m guessing) so I can find temperature and barometric pressure data?

No one has used this device on the Arduino platform? All threads do not document the tempature feature of this device.

Any advice? =(

I have not used this device. However, I read through the datasheet, it seems quite similar to other devices which many people have used.

You are including code for "intersemabaro.h" there, which presumably has functions which make the spi or i2c calls to the device, so you don't have to figure it out from scratch. I suggest you look at what the function calls in that library do.

I have gotten temperature working but not pressure. I have tried numerous times and have failed again and again. Here:

#include <Wire.h>
#define ADDRESS 0x76 //0x77
#include "IntersemaBaro.h"
Intersema::BaroPressure_MS5607B baro(true);
uint32_t D1 = 0;
uint32_t D2 = 0;
int64_t dT = 0;
int32_t TEMP = 0;
int64_t OFF = 0; 
int64_t SENS = 0; 
//int32_t P = 0;

uint16_t C[1];
//uint16_t C[2];
//uint16_t C[3];
//uint16_t C[4];
//uint16_t C[5];
//uint16_t C[6];
//uint16_t C[7];

//float Temperature;
//int32_t Px;
//float Pressurex;
//int32_t pressAvg;

void setup() {

  baro.init();
  // Disable internal pullups, 10Kohms are on the breakout
  PORTC |= (1 << 4);
  PORTC |= (1 << 5);
  Wire.begin();
  Serial.begin(19200); //9600 changed 'cos of timing?
  delay(100);
  initial(ADDRESS);

}

void loop()
{
  int alt = baro.getHeightCentiMeters();
//  int ppp = baro.ConvertPressureTemperature();
 float P;
// float P2;
// float P3;
// float P4;
  // compensated pressure value
  //double T;
  int32_t T2; //Unsigned int 32 bit for T2 (used for solving below 20 Celsius)
  int64_t OFF2; //Unsigned int 64 bit for OFF2 (used for solving below 20 Celsius)
  int64_t SENS2; //Unsigned int 64 bit for SENS2 (used for solving below 20 Celsius)

 D1 = getVal(ADDRESS, 0x48);// raw temperature value
 D2 = getVal(ADDRESS, 0x58);// raw temperature value
  
  //dT and Temp will calculate temperature
  dT = D2 - ((uint32_t)C[5] *(2*2*2*2*2*2*2*2));

  //off and sens will calculate temperature compensated pressure 
  dT=D2-C[5]*pow(2,8);
  OFF=C[2]*pow(2,17)+(dT*C[4])/pow(2,6);
  SENS=C[1]*pow(2,16)+(dT*C[3])/pow(2,7);
  TEMP = 2000 + (dT * (int32_t)C[6] / (8388608) ); //base temperature formula
  //T=(2000+(dT*C[6])/pow(2,23))/100;

 // P2  = (D1 * SENS /pow(2,21) - OFF) / pow(2,15); 
 


  if(TEMP <-1500) // FOR WHEN THE TEMPERATURE IS BELOW 20 CELSIUS
  {

    //Serial.print("Made pass through low temp\n"); 
    T2=((dT*dT)/pow(2,31));
    OFF2= OFF2+15*(TEMP+1500)*(TEMP+1500);
    SENS2 = SENS2+8*(TEMP+1500)*(TEMP+1500); 
  }

  else if(TEMP <2000 && TEMP >-1500) // FOR WHEN THE TEMPERATURE IS BELOW 20 CELSIUS
  {

    //Serial.print("Made pass through low temp\n"); 
    T2=((dT*dT)/pow(2,31));
    OFF2= (61)*((TEMP-2000)*(TEMP-2000))/(16); 
    SENS2 = 2*(TEMP-2000)*(TEMP-2000);

  }

  ///*
  else if(TEMP>2000) //FOR WHEN THE TEMPERATURE IS ABOVE 20 CELSIUS
  {

    T2=0;
    OFF2=0;
    SENS2 =0;

  } 

  //*/
  TEMP = TEMP - T2;
  OFF = OFF - OFF2;
  SENS = SENS - SENS2;

   P  = ((uint32_t)D1 * SENS /pow(2,21) - OFF) / pow(2,15);
// P3 = ((uint32_t)D1 * SENS /pow(2,21) - OFF) / pow(2,15);  
// P4 = (D1 * SENS /pow(2,21) - OFF) / pow(2,15); 
/*
Serial.print(P1);
Serial.print("      ");
Serial.print(D1);
Serial.println();
Serial.println();
Serial.print(P2);
Serial.print("      ");
Serial.print(D1);
Serial.println();
Serial.println();
Serial.print(P3);
Serial.print("      ");
Serial.print(D1);
Serial.println();
Serial.println();

Serial.print(P4);
Serial.print("      ");
Serial.print(D1);
Serial.println();
Serial.println();
*/
  //P=(((D1*SENS)/pow(2,21) - OFF)/pow(2,15)); //base temperature formula
  //Pressurex = ((float)P / 100.00);

 // P  = D1 * SENS - OFF;
  //Pressurex = (float)Px / 100;

///* //comment in later. Good Serial output
  Serial.print("TEMPERATURE READINGS:");
  Serial.print(TEMP/100.000);
  Serial.print(" degrees Centigrade      ");
  Serial.print(TEMP/100*1.8+32);
  Serial.print(" degrees Fahrenheit      ");
  Serial.print("Feet: "); 
  Serial.print(abs((float)(alt)/30.48));
  Serial.print("      ");
  Serial.print("Pressure: ");
  Serial.print(abs(P/100));
  Serial.print(" mb/hPA");
  Serial.print("      ");
  Serial.print(D1);
  Serial.println();
  delay(1);

}

//*/
//}
long getVal(int address, byte code)
{
  unsigned long ret = 0;
  Wire.beginTransmission(address);
  Wire.write(code);
  Wire.endTransmission();
  delay(10);
  // start read sequence
  Wire.beginTransmission(address);
  Wire.write((byte) 0x00);
  Wire.endTransmission();
  Wire.beginTransmission(address);
  Wire.requestFrom(address, (int)3);
  if (Wire.available() >= 3)
  {
    ret = Wire.read() * (unsigned long)65536 + Wire.read() * (unsigned long)256 + Wire.read();
  }
  else {
    ret = -1;
  }
  Wire.endTransmission();
  return ret;
}

void initial(uint8_t address)
{

  Serial.println();


  Wire.beginTransmission(address);
  Wire.write(0x1E); // reset
  Wire.endTransmission();
  delay(10);


  for (int i=0; i<6 ; i++) {

    Wire.beginTransmission(address);
    Wire.write(0xA2 + (i * 2));
    Wire.endTransmission();

    Wire.beginTransmission(address);
    Wire.requestFrom(address, (uint8_t) 6);
    delay(1);
    if(Wire.available())
    {
      C[i+1] = Wire.read() << 8 | Wire.read();
    }
    else {
      Serial.println("Error reading PROM 1"); // error reading the PROM or communicating with the device
    }
    Serial.println(C[i+1]);
  }
  Serial.println();
}
/*

 #include <Wire.h> 
 #include "IntersemaBaro.h"
 
 Intersema::BaroPressure_MS5607B baro(true);
 
 int temp = 0;
 
 void setup() { 
 Serial.begin(9600);
 baro.init();
 }
 
 void loop() {
 int alt = baro.getHeightCentiMeters();
 Serial.print("Centimeters: ");
 Serial.print((float)(alt));
 Serial.print(", Feet: ");
 Serial.println((float)(alt) / 30.48);
 // delay(400);
 Serial.println(temp);
 delay(1000);
 }
 */