// Routine für den BME280

#define BME280

#include "handlebme280.h"

TwoWire I2CBME = TwoWire(0);
Adafruit_BME280 bme;


void initBME280() {
   I2CBME.begin(I2C_SDA, I2C_SCL, 100000);
  if (!bme.begin(0x76, &I2CBME)) {
    Serial.println("Could not find a valid BME280 sensor, check wiring!");
    while (1);
  }
  Serial.println("BME280 sensor found!");
}

BME280Data readBME280() {
  BME280Data data;
  data.temp = bme.readTemperature();
  data.hum = bme.readHumidity();
  data.pres = bme.readPressure() / 100.0F;
    
  Serial.print("Temperature = ");
  Serial.print(data.temp);
  Serial.println(" °C");

  Serial.print("Pressure = ");
  Serial.print(data.pres);
  Serial.println(" hPa");

  Serial.print("Humidity = ");
  Serial.print(data.hum);
  Serial.println(" %");

  Serial.println();

return data;
}