Advertisement
rozman50

DHT

Jun 11th, 2018
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include <dht.h>
  2. #define dataPin 4
  3. dht DHT;
  4.  
  5. void setup() {
  6. Serial.begin(9600);
  7.  
  8. }
  9.  
  10. void loop() {
  11. int readData = DHT.read11(dataPin);
  12. float t = DHT.temperature;
  13. float h = DHT.humidity;
  14. Serial.println("Temperature: ");
  15. Serial.print(t);
  16. Serial.print(" ºC");
  17. Serial.println("Humidity: ");
  18. Serial.print(h);
  19. Serial.print(" % ");
  20. delay(2000);
  21. }
  22.  
  23. // + (levo) na 5V oranžno
  24. // OUT (srednje) D4 belo
  25. // - (desno) na GND rjavo
  26.  
  27. // https://arduino.stackexchange.com/questions/44898/dht-h-library-not-being-imported
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement