1#include <math.h>
2#include "LiquidCrystal.h"
3LiquidCrystal lcd(2,3,4,5,6,7);
4float A = 1.009249522e-03, B = 2.378405444e-04, C = 2.019202697e-07;
5float T,logRt,Tf,Tc;
6float Thermistor(int Vo) {
7 logRt = log(10000.0*((1024.0/Vo-1)));
8 T = (1.0 / (A + B*logRt + C*logRt*logRt*logRt));
9 Tc = T - 273.15;
10 Tf = (Tc * 1.8) + 32.0;
11 return T;
12}
13
14void setup(){
15 lcd.begin(16,2);
16 lcd.setCursor(0,0);
17 lcd.print(" Digital");
18 lcd.setCursor(0,1);
19 lcd.print(" Temperature");
20 delay(8000);
21 lcd.clear();
22 lcd.print(" Shashwat__Raj");
23 delay(8000);
24 lcd.clear();
25}
26
27void loop()
28{
29 lcd.setCursor(0,0);
30 lcd.print("Temp:");
31 lcd.print((Thermistor(analogRead(0))));
32 lcd.print("k ");
33
34 lcd.setCursor(0,1);
35 lcd.print((Tc));
36 lcd.print(" C ;");
37
38 lcd.setCursor(9,1);
39 lcd.print((Tf));
40 lcd.print(" F");
41 delay(800);
42}
43