#include #include #include /* Libraries needed: */ /* Adafruit_BMP085_Unified */ /* Adafruit_Unified_Sensor */ #define HOEHE 491 // Ort, Meter ueber Normalnull #include "DHT.h" /* Libraries needed: */ /* DHT_sensor_library */ #define DHTPIN 9 // Pin Nummer am Arduino, an dem Sensor angeschlossen #define DHTTYPE DHT11 // DHT11 oder DHT22 eintragen Adafruit_BMP085_Unified bmp = Adafruit_BMP085_Unified(10085); DHT dht(DHTPIN, DHTTYPE); void setup(void) { Serial.begin(9600); Serial.println("Pressure Sensor Test"); Serial.println(""); /* Initialise the sensor */ if(!bmp.begin()) { /* There was a problem detecting the BMP085 ... check your connections */ Serial.print("Ooops, no BMP085 detected ... Check your wiring or I2C ADDR!"); while(1); } Serial.begin(9600); Serial.println("DHT11 Testprogramm"); dht.begin(); } void loop(void) { /* Get a new sensor event */ sensors_event_t event; bmp.getEvent(&event); /* Display the results (barometric pressure is measure in hPa) */ if (event.pressure) { /* Display atmospheric pressure in hPa */ Serial.print("Luftdruck p / p0: "); Serial.print(event.pressure); Serial.print(" / "); Serial.print(bmp.seaLevelForAltitude( HOEHE , event.pressure)); Serial.print(" hPa"); Serial.print("\t\t"); // Tabulator } else { Serial.println("Sensor error"); } float h = dht.readHumidity(); // Read humidity and store in variable h float t = dht.readTemperature(); // Read temperature and store in variable t /***************** Check if all values are read correctly *****************/ if (isnan(h) || isnan(t)) { Serial.println("Fehler beim auslesen des Sensors!"); return; } // Send to PC and display in serial monitor Serial.print("Luftfeuchtigkeit: "); Serial.print(h); // Ausgeben der Luftfeuchtigkeit Serial.print(" %\t"); // Tabulator Serial.print("Temperatur: "); Serial.print(t); // Ausgeben der Temperatur Serial.println(" C"); // Wait a few seconds between measurements. delay(5000); }