Advertisement
Guest User

Untitled

a guest
Mar 30th, 2020
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #include <LiquidCrystal.h>
  2. LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
  3.  
  4. void setup(){
  5. lcd.begin(16, 2);
  6. }
  7.  
  8. void loop(){
  9.  
  10. double val = analogRead(A0);
  11. double temp = ((val * 0.00488) - 0.5) / 0.01;
  12.  
  13. digitalWrite(8, LOW);
  14. digitalWrite(9, LOW);
  15. int in = digitalRead(6);
  16. int sx = digitalRead(7);
  17. int dx = digitalRead(10);
  18. int cont = 20;
  19.  
  20. lcd.clear();
  21.  
  22. lcd.setCursor(0, 0);
  23. lcd.print("Temp: ");
  24. lcd.print(temp);
  25. lcd.print(" ^C");
  26.  
  27. lcd.setCursor(0, 1);
  28. lcd.print(cont);
  29.  
  30. if(sx == HIGH){cont = cont + 1;}
  31.  
  32. // if(temp < 20 || in == HIGH){lcd.print("Caldaia accesa");}
  33. // else(lcd.print("Caldaia spenta"));
  34.  
  35. if(temp < 20 || in == HIGH){digitalWrite(8, HIGH);}
  36. else(digitalWrite(9, HIGH));
  37.  
  38.  
  39. delay(500);
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement