#include <dht11.h>
//调用 DHT11 扩展库
dht11 DHT11;
#define DHT11PIN 2

void setup() {
  // put your setup code here, to run once:
Serial.begin(1200);
Serial.println("DHT11 Monitoring");

}

void loop() {
  // put your main code here, to run repeatedly:
int val = DHT11.read(DHT11PIN);
//输出湿度值
Serial.print("Humidity (%): ");
Serial.println((float)DHT11.humidity);
//输出温度值
Serial.print("Temperature (oC): ");
Serial.println((float)DHT11.temperature);
delay(1000);

}
