top of page

dht DHT;

#define DHT11_PIN 5
int ledR = 11; // que je vais alumé proportionelement a la chaleur
int ledV = 10; // que je vais alumé proportionelmetn a l'humidité
int ledB = 9; // que je vais étindre proportionelement a la chaleur

void setup()
{
  pinMode (ledR, OUTPUT);
  pinMode (ledV, OUTPUT);
  pinMode (ledB, OUTPUT);
 
  Serial.begin(115200); // attention, bien regler tes baud sur 115200 depuis ton moniteur (en bas a droite de celui ci))
  Serial.println("DHT TEST PROGRAM ");
  Serial.print("LIBRARY VERSION: ");
  Serial.println(DHT_LIB_VERSION);
  Serial.println();
  Serial.println("Type,\tstatus,\tHumidity (%),\tTemperature (C)");
 

}

void loop()
{
  // READ DATA << mecture des donné
  Serial.print("DHT11, \t");
  int chk = DHT.read11(DHT11_PIN);
 
  // DISPLAY DATA <<< rendu des donné sur le moniteur
  Serial.print(DHT.humidity, 1);
  Serial.print(",\t");
  Serial.print(DHT.temperature, 1);

 float t = DHT.temperature;

Serial.print("  "); 
Serial.print ("valeur perso de t:  ");  

 Serial.print (t);
int mapRt = map (t, 10 , 50 , 0, 255)

if(mapRt <0) {mapRt =0;}

if(mapRt >255) {mapRt =255;}

analogWrite (ledR,mapRt);

 int mapBt = map (t, 10 , 50 , 255, 0); 
if(mapBt <0) {mapBt =0;} 
if(mapBt >255) {mapBt =255;} 
analogWrite (ledB,mapBt); 

​

float h = DHT.humidity;  
Serial.print("  ");
Serial.print ("valeur perso de h:  "); 
Serial.print (h);
int mapVh = map (h, 0 , 100 , 0, 255); 
if(mapVh <0) {mapRt =0;} 
if(mapVh >255) {mapRt =255;} 
analogWrite (ledV,mapVh);

​

Serial.print("  led=  ");
Serial.print("rouge temp=  ");
Serial.print(mapRt);
Serial.print(" bleu temp=  "); // pour verifier que les valeur sont bonne
Serial.print(mapBt);
Serial.print("vert hum=  ");
Serial.println(mapVh);
  delay(200);
}

May 28

A night to remember. Fresh cheesecake, figs, and pinot noir.

Wine & Dessert Party

bottom of page