SHARE
TWEET

Sensor de umidade e temperatura DHT11

a guest Oct 21st, 2017 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Programa : Sensor de umidade e temperatura DHT11
  2. //Autor : Arduino e Cia
  3.  
  4. #include <dht.h>
  5.  
  6. #define dht_dpin A2 //Pino DATA do Sensor ligado na porta Analogica A2
  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("Temp: ");
  23.   Serial.print(DHT.temperature);
  24.   Serial.println(" Celsius");
  25.  
  26.   //Não diminuir o valor abaixo. O ideal é a leitura a cada 2 segundos
  27.   delay(2000);  
  28. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top