 
  *******************************************************************************/
 
-#include <lmic.h>
+#include <lmic.h> //lmic master library (LoRa) 
 #include <hal/hal.h>
-#include <SPI.h>
-
-#include <Adafruit_BME280.h>
-#include <Adafruit_Sensor.h>
-#define SEALEVELPRESSURE_HPA (1013.25)
+//#include <SPI.h> falls Sensoren mit SPI betrieben werden sollen
+
+#include <Adafruit_BME280.h> //bme library einbinden
+#include <Adafruit_Sensor.h> //Zusatz zur bme library
+#define SEALEVELPRESSURE_HPA (1013.25) //
 
 Adafruit_BME280 bme; //I2C
 

}

void sensor_data() {
  float temp = (bme.readTemperature() + 50) * 100;
  uint16_t temperature = (uint16_t) temp;
  Serial.println();
  Serial.print(temperature);
  Serial.println();
  uint8_t hightemp = (uint8_t) ((temperature & 0xFF00) >> 8);
  uint8_t lowtemp = (uint8_t) (temperature & 0xFF);
  Serial.println();
  Serial.print(hightemp);
  Serial.println();
  Serial.println(); 
  Serial.print(lowtemp);
  Serial.println();
  mydata[0] = hightemp;
  mydata[1] = lowtemp;

  float pre = bme.readPressure() / 100.0F;
  uint16_t pressure = (uint16_t ) ((pre / 1013.25) * 100);
  uint8_t pres = (uint8_t) pressure;

  mydata[2] = pres;
  Serial.println(pressure);
  Serial.println(); 

  float hum = bme.readHumidity() * 100;
  uint16_t humidity = (uint16_t) hum;
  uint8_t highhum = (uint8_t) ((humidity & 0xFF00) >> 8);
  uint8_t lowhum = (uint8_t) (humidity & 0xFF);

  mydata[3] = highhum;
  mydata[4] = lowhum;

  Serial.println(humidity); 
  Serial.println(mydata[3]); 
  Serial.println(); 
  Serial.println(mydata[4]);
  

  sensorValue = analogRead(analogInPin); 
  float voltage = (3.3/4096*sensorValue);
  float strom = (voltage/10020);
  float lichtstrom = (strom*2*1000000);
  lichtstrom = lichtstrom / 6.5852;         //In Prozent 658,52 (Maximalwert) / 100
  uint8_t lichtstrom_int = (uint8_t) lichtstrom;

  Serial.print("Helligkeit: "); 
  Serial.print(lichtstrom);
  Serial.print("%");
  Serial.print("\n");
  

  mydata[5] = lichtstrom_int;

  soilPower = analogRead(soilPin); 

  uint8_t percent = (uint8_t) ((analogRead(A2)/33.30F) * 100); 
  Serial.println(percent);
  
  mydata[6] = percent; 

  
}




static uint8_t sensordata[7];
static osjob_t sendjob;

// Schedule TX every this many seconds (might become longer due to duty
