#include "DHT.h"
#define DHTTYPE DHT12
#define DHTPIN 2
DHT capteur(DHTPIN, DHTTYPE);
void setup(){
Serial.begin(115200);
capteur.begin();
}
void loop(){
delay(1000);
float temperature = capteur.readTemperature();
float humidity = capteur.readHumidity();
if (isnan(temperature) || isnan(humidity) ){
Serial.println("La lecture n'a pas pu être effectuée ! ");
}
Serial.print("\n\nMesures : ");
Serial.print(F("Humidity: "));
Serial.print(humidity);
Serial.print(F("% Temperature: "));
Serial.print(temperature);
Serial.print(F("°C "));
delay(1000);
}