DHT22

Temperatura y Humedad

#include  "DHT.h"             
const  int  DHTPIN  =  2 ;       
const  int  DHTTYPE  =  DHT11 ;  
 
DHT  dht ( DHTPIN ,  DHTTYPE ) ; 
void  setup ( )  { 
  Serial . begin ( 9600 ) ; 
  dht . begin ( ) ;        
}
 
void  loop ( )  {
   float  h  =  dht . readHumidity ( ) ;     
  float  t  =  dht . readTemperature ( ) ; 
 
  Serial . print ( "Temperatura:" ) ; 
  Serial . println ( t ) ;                
  Serial . print ( "Humedad:" ) ; 
  Serial . print ( h ) ;  
  Serial . print ( "%" ) ;       
  Serial . println ( ) ;                
  delay ( 1000 ) ;                      
}

Last updated