MX PRACTICAL DAS


#include "dht.h"
#define dht_apin A0 // Analog Pin sensor is connected to
float tem;
int temPin = 1;
float temp;
dht DHT;
void setup(){
  Serial.begin(9600);
  Serial.println("DHT11 Humidity & temperature Sensor\n\n");
  Serial.println("CLEARDATA");
  Serial.println("LABEL,ComputerTime,Temperatute(C),Humidity");
  //delay(1000);//Wait before accessing Sensor

}//end "setup()"

void loop(){
  //Start of Program
 Serial.print("DATA,TIME,");
 //Serial.print("DATE,");
    tem = analogRead(temPin);
    tem = tem * 0.48828125;
    Serial.print(tem);
    Serial.print(",");
    DHT.read11(dht_apin);
    Serial.print("Current humidity = ");
    Serial.print(DHT.humidity);
   Serial.print("%  ");
    Serial.print(",");
    // temp=DHT.humidity;
    //Serial.print(temp);
    //Serial.print(",");
    // Serial.print(temp);
    //Serial.print("TEMPRATURE = ");
    //Serial.print(tem);
    // Serial.print("*C");
Serial.println();

delay(1000);

}// end loop() 

Previous Post Next Post