 int counter=10;
 
 bool has_bme = true;
+bool has_sgp = true;
+
+volatile float bme_temperature = 0;
+volatile float bme_humidty = 0;
+
+
+/* return absolute humidity [mg/m^3] with approximation formula
+* @param temperature [°C]
+* @param humidity [%RH]
+*/
+uint32_t getAbsoluteHumidity(float temperature, float humidity) {
+    // approximation formula from Sensirion SGP30 Driver Integration chapter 3.15
+    const float absoluteHumidity = 216.7f * ((humidity / 100.0f) * 6.112f * exp((17.62f * temperature) / (243.12f + temperature)) / (273.15f + temperature)); // [g/m^3]
+    const uint32_t absoluteHumidityScaled = static_cast<uint32_t>(1000.0f * absoluteHumidity); // [mg/m^3]
+    return absoluteHumidityScaled;
+}
 
 void setup()
 {
-  Serial.begin(57600);
-  Serial.println("MIKROE SAM3X WeatherDemo");
-
-  bme_init();
+	Serial.begin(57600);
+	Serial.println("MIKROE SAM3X WeatherDemo:#");
+
+	bme_init();
+	sgp_init();
 
 //  SPI.begin();
 //  SPI.setDataMode( SPI_MODE1 );

//    }
//  }

  bme_read();

  counter++;
  if (counter == 100)
  {
    counter = 10;
  }

  delay(5000); // wait 5 seconds for the next I2C scan
}

void bme_init() {
   if (! bme.begin(0x76, &Wire)) {
        Serial.println("Could not find a valid BME280 sensor, check wiring!");
        has_bme=false;
    }  
}

void bme_read() {
    bme.takeForcedMeasurement(); // has no effect in normal mode

    Serial.print("MIKROESAM3X_WC:");
    Serial.print(counter);
    Serial.print(":Temp:");
    float bme_temp_c = bme.readTemperature();
    float bme_temp_f = ((bme_temp_c * 1.8) + 32);
    Serial.print(bme_temp_f);
    Serial.print("F:Press:");
    Serial.print(bme.readPressure() / 100.0F);
    Serial.print("mB:Humidity:");
    Serial.print(bme.readHumidity());
    Serial.println("%:#");
}

void thunder_init()

#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>

/* Adafruit SGP30 Sensor: 1.0.5 */
#include <Adafruit_SGP30.h>

#include "flip_click_defs.h"
//#include "SparkFun_AS3935.h"

Adafruit_BME280 bme; // I2C
Adafruit_SGP30 sgp;

unsigned long delayTime;

