Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #include <math.h>
  2. #include <dht.h>
  3. dht DHT;
  4. #define DHT11_PIN 7
  5. const int ThermistorPin = A0;
  6. //LiquidCrystal lcd(12,11,5,4,3,2);
  7. float R1 = 10000;
  8. float logR2, R2, T;
  9. float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07;
  10.  
  11. void setup() {
  12. Serial.begin(9600);
  13. }
  14.  
  15. void loop() {
  16. int Vo = analogRead(ThermistorPin);
  17. R2 = R1 * (1023.0 / (float)Vo - 1.0);
  18. logR2 = log(R2);
  19. T = (1.0 / (c1 + c2*logR2 + c3*logR2*logR2*logR2));
  20. T = T - 273.15;
  21.  
  22. int chk = DHT.read11(DHT11_PIN);
  23. int h = (DHT.humidity);
  24. int t = (DHT.temperature );
  25. Serial.println(t);
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement