使用BMP085氣壓傳感器
對比差異
Temperature = 27.60 *C
Pressure = 94461 Pa
Altitude = 587.82 meters
Pressure at sealevel (calculated) = 94456 Pa
Real altitude = 16116.56 meters
Temperature = 27.60 *C
Pressure = 94460 Pa
Altitude = 588.09 meters
Pressure at sealevel (calculated) = 94463 Pa
Real altitude = 16116.62 meters
精簡后代碼
#include <Adafruit_BMP085.h>
Adafruit_BMP085 bmp;
void setup() {
Serial.begin(9600);
while(!Serial);
if (!bmp.begin()) {
Serial.println("Could not find a valid BMP085 sensor, check wiring!");
while (1) {}
}
}
void loop() {
delay(500);
Serial.print("Temperature = ");
Serial.print(bmp.readTemperature());
Serial.println(" *C");
Serial.print("Pressure = ");
Serial.print(bmp.readPressure());
Serial.println(" Pa");
Serial.print("Altitude = ");
Serial.print(bmp.readAltitude());
Serial.println(" meters");
Serial.print("Pressure at sealevel (calculated) = ");
Serial.print(bmp.readSealevelPressure());
Serial.println(" Pa");
Serial.print("Real altitude = ");
Serial.print(bmp.readAltitude(1015000));
Serial.println(" meters");
delay(5000);
}
模塊參考數(shù)據(jù):
壓力范圍:300-1100hPa啄刹,海拔-500-9000米
電源電壓:1.8V-3.6V(VDDA) 1.62V-3.6V(VDDD)