#define FRANCAIS 1
#define ANGLAIS 2
#define LANGUE FRANCAIS
#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
#if (LANGUE == FRANCAIS)
#define MSG_DEBUT "Début du programme de test de la DHT22"
#define MSG_TEMPERATURE "Température = "
#define MSG_HUMIDITE ", Humidité = "
#endif
#if (LANGUE == ANGLAIS)
#define MSG_DEBUT "Start of test program for the DHT22"
#define MSG_TEMPERATURE "Temperature = "
#define MSG_HUMIDITE ", Humidity = "
#endif
// variable de controle 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"
Serial << MSG_HUMIDITE << dht.readHumidity() << "%" << endl;
// Attendre un ti moment ;-)
delay(UN_TI_MOMENT);
}