adityatandon

NodeMCU DHT11 No Internet

Sep 26th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #include "DHT.h" // including the library of DHT11 temperature and humidity sensor
  2. #define DHTTYPE DHT11 // DHT 11
  3.  
  4. #define dht_dpin D7
  5. DHT dht(dht_dpin, DHTTYPE);
  6. void setup(void)
  7. {
  8. dht.begin();
  9. Serial.begin(9600);
  10. Serial.println("Humidity and temperature \n\n");
  11. Serial.println("==========================================");
  12. delay(700);
  13.  
  14. }
  15. void loop() {
  16. float h = dht.readHumidity();
  17. float t = dht.readTemperature();
  18. Serial.print("Current humidity = ");
  19. Serial.print(h);
  20. Serial.print("% temperature = ");
  21. Serial.print(t);
  22. Serial.println("degree Celsius");
  23. delay(800);
  24. }
Add Comment
Please, Sign In to add comment