/*ThermoDisplay*/
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
int temp;
int sensor = A0;
int tempc;
int tempf;
void setup()
{
Serial.begin(9600);
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("Temp");
}
void loop()
{
temp=analogRead(sensor); //Read analog voltage from sensor and store it in a temporary float variable.
//tempc=(temp/1024)*500;
tempc=(125*temp)>>8;
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Temp in C = ");
lcd.print(tempc);
//Above two lines print Temperature value in °C.
lcd.setCursor(0,1);
tempf=((tempc*9)/5+32);
lcd.print("Temp in F = ");
lcd.print(tempf);
//Above two lines print value in Fahrenheit
delay(5000);
}
Loading
ds18b20
ds18b20