2019-08-04 11:56:18 +02:00
|
|
|
#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;
|
|
|
|
|
2022-09-14 11:55:43 +02:00
|
|
|
bool sensor_bme280_begin(uint8_t addr)
|
|
|
|
{
|
2019-08-04 11:56:18 +02:00
|
|
|
bool status = _sensor_bme280.begin(addr);
|
2022-09-14 11:55:43 +02:00
|
|
|
|
|
|
|
if (status)
|
|
|
|
{
|
2020-02-18 20:06:03 +01:00
|
|
|
debug("BME280 Connected");
|
2022-09-14 11:55:43 +02:00
|
|
|
|
2019-08-04 11:56:18 +02:00
|
|
|
} else {
|
|
|
|
debug("Could not find a valid BME280 sensor, check wiring!");
|
|
|
|
}
|
2022-09-14 11:55:43 +02:00
|
|
|
|
2019-08-04 11:56:18 +02:00
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2022-09-14 11:55:43 +02:00
|
|
|
float bme280_temperature()
|
|
|
|
{
|
2022-05-15 22:47:23 +02:00
|
|
|
return _sensor_bme280.readTemperature() * TEMP_FACTOR;
|
2019-08-04 11:56:18 +02:00
|
|
|
}
|
2022-09-14 11:55:43 +02:00
|
|
|
|
|
|
|
float bme280_pressure()
|
|
|
|
{
|
2019-08-04 11:56:18 +02:00
|
|
|
return _sensor_bme280.readPressure() / 100.0F;
|
|
|
|
}
|
2022-09-14 11:55:43 +02:00
|
|
|
|
|
|
|
float bme280_humidity()
|
|
|
|
{
|
2019-08-04 11:56:18 +02:00
|
|
|
return _sensor_bme280.readHumidity() * HUMIDITY_FACTOR;
|
2022-05-15 22:47:23 +02:00
|
|
|
}
|