Advertisement
Guest User

Sensor de umidade e temperatura DHT11 testado com Arduino

a guest
Mar 28th, 2014
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.70 KB | None | 0 0
  1. //Programa : Sensor de umidade e temperatura DHT11
  2. // Mais informacoes em:
  3. // http://drbitblog.wordpress.com/2014/03/28/sensor-de-temperatura-e-umidade-dth11/
  4.  
  5. #include <dht.h>
  6. #define dht_dpin A1 //Pino Sinal do Sensor ligado na porta Analogica A1
  7.  
  8. dht DHT; //Inicializa o sensor
  9.  
  10. void setup()
  11. {
  12.   Serial.begin(9600);
  13.   delay(1000);//Aguarda 1 seg antes de acessar as informações do sensor
  14. }
  15.  
  16. void loop()
  17. {
  18.     DHT.read11(dht_dpin); //Lê as informações do sensor
  19.     Serial.print("Umidade = ");
  20.     Serial.print(DHT.humidity);
  21.     Serial.print(" %  ");
  22.     Serial.print("Temperatura = ");
  23.     Serial.print(DHT.temperature);
  24.     Serial.println(" Celsius  ");
  25.     delay(2000);  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement