Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. #include <LiquidCrystal.h>
  2. LiquidCrystal lcd(12,11,5,4,10,13);
  3.  
  4. const int sens=A0;
  5. float RT, VR, ln, TX, T0, VRT;
  6. int VCC=5;
  7. int RTO=10000;
  8. int B=3977;
  9. int R=10000;
  10.  
  11. void setup() {
  12. // put your setup code here, to run once:
  13. lcd.begin(16,2); //imposta il numero di colonne e righe
  14. analogReference(EXTERNAL); //il pin aref รจ collegato alla tensione di riferimento di 3,3v
  15. T0 = 25 + 273.15;
  16. }
  17.  
  18. void loop() {
  19. // put your main code here, to run repeatedly:
  20.  
  21.  
  22. VRT = analogRead(A0); //Acquisition analog value of VRT
  23. VRT = (5.00 / 1023.00) * VRT; //Conversion to voltage
  24. VR = VCC - VRT;
  25. RT = VRT / (VR / R); //Resistance of RT
  26.  
  27. ln = log(RT / RTO);
  28. TX = (1 / ((ln / B) + (1 / T0))); //Temperature from thermistor
  29.  
  30. TX = TX - 273.15; //Conversion to Celsius
  31.  
  32.  
  33. lcd.setCursor(0,0);
  34. lcd.print("temperatura in Celsius: ");
  35. lcd.setCursor(0,1);
  36. lcd.print(TX);
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement