Merge branch 'master' of github.com:adafruit/Adafruit_BME280_Library
Conflicts: Adafruit_BME280.h examples/bme280test/bme280test.ino
This commit is contained in:
commit
dbd60ee741
|
|
@ -64,8 +64,8 @@ bool Adafruit_BME280::begin(uint8_t a) {
|
|||
return false;
|
||||
|
||||
readCoefficients();
|
||||
write8(BME280_REGISTER_CONTROLHUMID, 0x03); // Set before CONTROL (DS 5.4.3)
|
||||
write8(BME280_REGISTER_CONTROL, 0x3F);
|
||||
write8(BME280_REGISTER_CONTROLHUMID, 0x03);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -321,3 +321,25 @@ float Adafruit_BME280::readHumidity(void) {
|
|||
float h = (v_x1_u32r>>12);
|
||||
return h / 1024.0;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
Calculates the altitude (in meters) from the specified atmospheric
|
||||
pressure (in hPa), and sea-level pressure (in hPa).
|
||||
|
||||
@param seaLevel Sea-level pressure in hPa
|
||||
@param atmospheric Atmospheric pressure in hPa
|
||||
*/
|
||||
/**************************************************************************/
|
||||
float Adafruit_BME280::readAltitude(float seaLevel)
|
||||
{
|
||||
// Equation taken from BMP180 datasheet (page 16):
|
||||
// http://www.adafruit.com/datasheets/BST-BMP180-DS000-09.pdf
|
||||
|
||||
// Note that using the equation from wikipedia can give bad results
|
||||
// at high altitude. See this thread for more information:
|
||||
// http://forums.adafruit.com/viewtopic.php?f=22&t=58064
|
||||
|
||||
float atmospheric = readPressure() / 100.0F;
|
||||
return 44330.0 * (1.0 - pow(atmospheric / seaLevel, 0.1903));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,8 +140,12 @@ class Adafruit_BME280
|
|||
float readTemperature(void);
|
||||
float readPressure(void);
|
||||
float readHumidity(void);
|
||||
<<<<<<< HEAD
|
||||
|
||||
float readAltitude(float seaLevelhPa = 1013.25);
|
||||
=======
|
||||
float readAltitude(float seaLevel);
|
||||
>>>>>>> 11ad05a034c3ef433825590ef39c8cc11cd1e50b
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@
|
|||
#define BME_MOSI 11
|
||||
#define BME_CS 10
|
||||
|
||||
#define SEALEVELPRESSURE_HPA (1013.25)
|
||||
|
||||
Adafruit_BME280 bme; // I2C
|
||||
//Adafruit_BME280 bme(BME_CS); // hardware SPI
|
||||
//Adafruit_BME280 bme(BME_CS, BME_MOSI, BME_MISO, BME_SCK);
|
||||
|
|
@ -45,6 +47,7 @@ void loop() {
|
|||
Serial.println(" *C");
|
||||
|
||||
Serial.print("Pressure = ");
|
||||
<<<<<<< HEAD
|
||||
Serial.print(bme.readPressure());
|
||||
Serial.println(" Pa");
|
||||
|
||||
|
|
@ -52,6 +55,15 @@ void loop() {
|
|||
Serial.print(bme.readAltitude(1013.25)); // this should be adjusted to your local forcase
|
||||
Serial.println(" m");
|
||||
|
||||
=======
|
||||
Serial.print(bme.readPressure() / 100.0F);
|
||||
Serial.println(" hPa");
|
||||
|
||||
Serial.print("Approx. Altitude = ");
|
||||
Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA));
|
||||
Serial.println(" m");
|
||||
|
||||
>>>>>>> 11ad05a034c3ef433825590ef39c8cc11cd1e50b
|
||||
Serial.print("Humidity = ");
|
||||
Serial.print(bme.readHumidity());
|
||||
Serial.println(" %");
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
name=Adafruit BME280 Library
|
||||
version=1.0.0
|
||||
author=Adafruit
|
||||
maintainer=Adafruit <info@adafruit.com>
|
||||
sentence=Arduino library for BME280 sensors.
|
||||
paragraph=Arduino library for BME280 humidity and pressure sensors.
|
||||
category=Sensors
|
||||
url=https://github.com/adafruit/Adafruit_BME280_Library
|
||||
architectures=*
|
||||
Loading…
Reference in New Issue