#include "DHT.h"
#include <Streaming.h>
#define DHTPIN 2 // Broche de connexion du capteur de température
#define UN_TI_MOMENT 500
#define VITESSE_UART 9600
#define MSG_DEBUT "Début du programme de test de la DHT22"
#define MSG_TEMPERATURE "Température = "
#define MSG_HUMIDITE ", Humidité = "
// variable de contrôle du capture temp/hum.
DHT dht(DHTPIN, DHT22);
void setup() {
Serial.begin(VITESSE_UART);
Serial << MSG_DEBUT;
dht.begin();
}
void loop() {
Serial << MSG_TEMPERATURE << dht.readTemperature() << "c"; // You can put true inside of the () for it to be in F
Serial << MSG_HUMIDITE << dht.readHumidity() << "%" << endl;
// Attendre un ti moment ;-)
delay(UN_TI_MOMENT);
}