barometer: print a message on barometer init in example code

this helps track down initialisation problems
This commit is contained in:
Andrew Tridgell 2011-09-11 09:39:35 +10:00
parent 43e77222ff
commit 89f664e3b0
1 changed files with 7 additions and 5 deletions

View File

@ -12,9 +12,11 @@ unsigned long timer;
void setup() void setup()
{ {
APM_BMP085.Init(); // APM ADC initialization Serial.begin(115200);
Serial.begin(38400);
Serial.println("ArduPilot Mega BMP085 library test"); Serial.println("ArduPilot Mega BMP085 library test");
Serial.println("Initialising barometer..."); delay(100);
APM_BMP085.Init(); // APM ADC initialization
Serial.println("initialisation complete."); delay(100);
delay(1000); delay(1000);
timer = millis(); timer = millis();
} }
@ -28,11 +30,11 @@ void loop()
if((millis()- timer) > 50){ if((millis()- timer) > 50){
timer = millis(); timer = millis();
APM_BMP085.Read(); APM_BMP085.Read();
Serial.print("Pressure:"); Serial.print("Pressure:");
Serial.print(APM_BMP085.Press); Serial.print(APM_BMP085.Press);
Serial.print(" Temperature:"); Serial.print(" Temperature:");
Serial.print(APM_BMP085.Temp / 10.0); Serial.print(APM_BMP085.Temp / 10.0);
Serial.print(" Altitude:"); Serial.print(" Altitude:");
tmp_float = (APM_BMP085.Press / 101325.0); tmp_float = (APM_BMP085.Press / 101325.0);
tmp_float = pow(tmp_float, 0.190295); tmp_float = pow(tmp_float, 0.190295);
Altitude = 44330 * (1.0 - tmp_float); Altitude = 44330 * (1.0 - tmp_float);