double getTemperaturePressure()
{
char status;
double T,P,p0,a;
// const double R = 287.05; // J/Kg°K
// const double g = 9.80665; //m/s 2.
// You must first get a temperature measurement to perform a pressure reading.
// Start a temperature measurement:
// If request is successful, the number of ms to wait is returned.
// If request is unsuccessful, 0 is returned.
status = pressure.startTemperature();
if (status != 0)
{
// Wait for the measurement to complete:
delay(status);
// Retrieve the completed temperature measurement:
// Note that the measurement is stored in the variable T.
// Use '&T' to provide the address of T to the function.
// Function returns 1 if successful, 0 if failure.
status = pressure.getTemperature(T);
// Serial.print("Temp of pressure: ");
// Serial.println(T);
if (status != 0)
{
return T;
}
else{
Serial.println("error retrieving temperature measurement\n");
return 0;
}
}
else {
Serial.println("error starting temperature measurement\n");
return 0;
}
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.