2016-03-11 00:43:24 +01:00
|
|
|
int getTemperature(double &t) {
|
|
|
|
char status;
|
2016-03-16 00:54:13 +01:00
|
|
|
status = bmp180.startTemperature();
|
2016-03-11 00:43:24 +01:00
|
|
|
if (status != 0)
|
|
|
|
{
|
|
|
|
// Wait for the measurement to complete:
|
|
|
|
delay(status);
|
2016-03-16 00:54:13 +01:00
|
|
|
status = bmp180.getTemperature(t);
|
2016-03-11 00:43:24 +01:00
|
|
|
if (status != 0)
|
|
|
|
return 0;
|
|
|
|
}
|
2016-03-16 00:54:13 +01:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int getTempAndPressure(double &t, double &p) {
|
|
|
|
if (getTemperature(t) == 0) {
|
|
|
|
char status;
|
|
|
|
status = bmp180.startPressure(3);
|
|
|
|
if (status != 0)
|
|
|
|
{
|
|
|
|
delay(status);
|
|
|
|
status = bmp180.getPressure(p, t);
|
|
|
|
if (status != 0)
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return -1;
|
2016-03-11 00:43:24 +01:00
|
|
|
}
|