34 lines
730 B
C++
34 lines
730 B
C++
#include <Adafruit_BME280.h> // BME280 - https://www.roboter-bausatz.de/1704/bmp280-barometer-luftdrucksensor?gclid=EAIaIQobChMIlpumj8Hp2wIVFWYbCh01PgmFEAQYAyABEgIwBvD_BwE
|
|
#include "config_user.h"
|
|
|
|
Adafruit_BME280 _sensor_bme280;
|
|
|
|
bool sensor_bme280_begin(uint8_t addr)
|
|
{
|
|
bool status = _sensor_bme280.begin(addr);
|
|
|
|
if (status)
|
|
{
|
|
debug("BME280 Connected");
|
|
|
|
} else {
|
|
debug("Could not find a valid BME280 sensor, check wiring!");
|
|
}
|
|
|
|
return status;
|
|
}
|
|
|
|
float bme280_temperature()
|
|
{
|
|
return _sensor_bme280.readTemperature() * TEMP_FACTOR;
|
|
}
|
|
|
|
float bme280_pressure()
|
|
{
|
|
return _sensor_bme280.readPressure() / 100.0F;
|
|
}
|
|
|
|
float bme280_humidity()
|
|
{
|
|
return _sensor_bme280.readHumidity() * HUMIDITY_FACTOR;
|
|
}
|