   String c, v;
   switch (type) {
     case BMP180T:
-        double T;
-        c = "BMP180T";
-        if (bmp180Temperature(T)) v = String(T);
-        else v = c + " Error";
-        break;
+      {
+      double t;
+      c = "BMP180T";
+      if (bmp180Temperature(t)) v = String(t);
+      else v = c + " Error";
+      break;
+      }
+
     case BMP180P:
-        double P;
-        c = "BMP180P";
-        if (bmp180Pressure(P)) v = String(P);
-        else v = c + " Error";
-        break;
+      {
+      double p;
+      c = "BMP180P";
+      if (bmp180Pressure(p)) v = String(p);
+      else v = c + " Error";
+      break;
+      }
+
+    case DHT22T:
+      {
+      float t = dht.readTemperature();    // Default temperature unit is ºC.
+      c = "DHT22T";
+      v = String(t);
+      break;
+      }
+
+    case DHT22H:
+      {
+      float h = dht.readHumidity();
+      c = "DHT22H";
+      v = String(h);
+      break;
+      }
+    case DHT22HI:
+      {
+      float h, t, hi;
+      h = dht.readHumidity();
+      t = dht.readTemperature(true);    // We need value in farenheit.
+      hi = dht.computeHeatIndex(t,h);
+      c = "DHT22HI";
+      v = String(dht.convertFtoC(hi));
+      break;
+      }
   }
   sendCommand(c, v);
 }

  char status;
  if(bmp180Temperature(T)) {
    Serial.println(T);
    delay(500);
    status = pressure.startPressure(3);
    if (status != 0) {
        delay(status);

#include <Wire.h>
#include <SFE_BMP180.h>
#include "DHT.h"

#define count(x) sizeof(x)/sizeof(unsigned long)
#define groundPin A0


#define ALTITUDE 570 // We need it for the barometric pressure calculus

#define BMP180T 0   // Temperature
#define BMP180P 1   // Pressure
#define DHT22T  2   // Temperature
#define DHT22H  3   // Humidity
#define DHT22HI 4   // Heat Index

#define NOTUSED -1  // For BMP180/DHT22 sensor.

#define DHTTYPE DHT22
#define DHTPIN  4

SFE_BMP180 pressure;
DHT dht(DHTPIN, DHTTYPE);

int types[] = {BMP180T,BMP180P,DHT22T,DHT22H,DHT22HI};
unsigned long lastUpdate[] = {0,0,0,0,0};
unsigned long updateTimes[] = {30000,60000,30000,30000,60000};
int pins[] = {NOTUSED,NOTUSED,NOTUSED,NOTUSED,NOTUSED};

int secureAnalogRead(int pin) {
  //delay(0.01);
  //analogRead(groundPin);
  //delay(0.01);
  return analogRead(pin);
  
}
