patriotaSJ

sensor de temperatura y humeda

May 15th, 2015
837
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.73 KB | None | 0 0
  1. #include "DHT.h"
  2. #define DHTPIN 7
  3. #define DHTTYPE DHT11
  4. DHT dht(DHTPIN, DHTTYPE);
  5.  
  6. void setup() {
  7. Serial.begin(9600);
  8. dht.begin();
  9. }
  10. void loop() {  
  11. int h = dht.readHumidity();// Lee la humedad
  12. int t= dht.readTemperature();//Lee la temperatura
  13. //////////////////////////////////////////////////Humedad
  14. Serial.print("Humedad Relativa: ");                
  15. Serial.print(h);//Escribe la humedad
  16. Serial.println(" %");                    
  17. ///////////////////////////////////////////////////Temperatura              
  18. Serial.print("Temperatura: ");                  
  19. Serial.print(t);//Escribe la temperatura
  20. Serial.println(" C'");                  
  21. //delay (150);
  22. ///////////////////////////////////////////////////            
  23. }
Advertisement
Add Comment
Please, Sign In to add comment