//- (GND) to GND //+ (VDD) to 3.3V //Any Arduino pins labeled: SDA SCL //Uno, Redboard, Pro: A4 A5 //Mega2560, Due: 20 21 //Leonardo: 2 3 #include <SFE_BMP180.h> #include <Wire.h> // Wire Bibliothek einbinden SFE_BMP180 pressure; #define ALTITUDE 65.0 //Hoehe von Linz void setup() { Serial.begin(9600); Serial.println("REBOOT"); if (pressure.begin()) Serial.println("BMP180 init success"); else { Serial.println("BMP180 init fail\n\n"); while(1); // Pause forever. } } void loop() { char status; double T,P,p0,a; Serial.println(); Serial.print("provided altitude: "); Serial.print(ALTITUDE,0); Serial.print("meter"); status = pressure.startTemperature(); if (status != 0) { delay(status); status = pressure.getTemperature(T); if (status != 0) { Serial.print("temperature: "); Serial.print(T,2); Serial.print(" deg C, "); status = pressure.startPressure(3); if (status != 0) { delay(status); status = pressure.getPressure(P,T); if (status != 0) { Serial.print("absolute pressure: "); Serial.print(P,2); Serial.print(" mb, "); p0 = pressure.sealevel(P,ALTITUDE); Serial.print("relative (sea-level) pressure: "); Serial.print(p0,2); Serial.print(" mb, "); a = pressure.altitude(P,p0); Serial.print("computed altitude: "); Serial.print(a,0); Serial.print(" meters, "); // SerialCominstruments anfang Serial.print('#'); Serial.print(41); Serial.print('M'); Serial.print(p0,2); Serial.print('<'); Serial.print('#'); Serial.print(42); Serial.print('M'); Serial.print(P,2); Serial.print('<'); Serial.print('#'); Serial.print(44); Serial.print('M'); Serial.print(a,0); Serial.print('<'); } else Serial.println("error retrieving pressure measurement\n"); } else Serial.println("error starting pressure measurement\n"); } else Serial.println("error retrieving temperature measurement\n"); } else Serial.println("error starting temperature measurement\n"); delay(5000); // Pause for 5 seconds. }