You are on page 1of 1

#include​ ​<LiquidCrystal.

h>
LiquidCrystal​ ​lcd(12,11,5,4,3,2);
int​ ​val;
int​ ​tempPin​ ​=​ ​1;
void​ ​setup()
{
​ ​ ​lcd.begin​ ​(16,​ ​2);
}

void​ ​loop()
{
val​ ​=​ ​analogRead(tempPin);
​ ​ ​float​ ​mv​ ​=​ ​(val/1024.0)*5000;
​ ​ ​float​ ​cel​ ​=​ ​mv/10;
​ ​ ​float​ ​farh​ ​=​ ​(cel*9)/5+32;

​ ​ ​lcd.print("TEMPERATURE​ ​IS​ ​");


​ ​ ​lcd.setCursor(0,​ ​1);
​ ​ ​lcd.print(cel);
​ ​ ​lcd.setCursor(5,​ ​1);
​ ​ ​lcd.print("(C)");
​ ​ ​lcd.print(farh);
​ ​ ​lcd.print("​ ​f");
​ ​ ​delay​ ​(1000);
​ ​ ​lcd.clear();
}18g6aKqvyWnqrjpf95UHtq1B9fhHgTL2iR

You might also like