#include <OneWire.h>
#include <DallasTemperature.h>
#include <dht.h>

#define DHT11_PIN 7
#define ONE_WIRE_BUS_1 2

dht DHT;
OneWire oneWire_in(ONE_WIRE_BUS_1);
float temperature;
float sensorValue;
float powervoltage=5;
int chk; 
DallasTemperature sensor_inhouse(&oneWire_in);
int incomingByte = 0; 
void setup(void)
{
    Serial.begin(9600);
    sensor_inhouse.begin();
}

void loop(void)
{    if (Serial.available() > 0) 
     { incomingByte = Serial.read();
       if(incomingByte==1)
       {  sensor_inhouse.requestTemperatures();
          Serial.println(sensor_inhouse.getTempCByIndex(0));
       }
       else if(incomingByte==2)
       {  sensorValue = analogRead(A0);
          temperature=(sensorValue/1023)*powervoltage*100;
          Serial.println(temperature);  
       }
       else if(incomingByte==3)
       {chk = DHT.read11(DHT11_PIN);
        Serial.println(DHT.temperature);
       }
       else if(incomingByte==4)
       {chk = DHT.read11(DHT11_PIN);
        Serial.println(DHT.humidity);
       }
       delay(50);
     }
}




