Rajat Naruka
Published © GPL3+

Temperature display using LCD

In this project, temperature will be displayed in LCD using temperature sensor.

IntermediateProtip1,458
Temperature display using LCD

Things used in this project

Schematics

GY4yqsuHVVxBivh7n8Pe.JPG

Code

Temperature display on lcd

Java
#include <rgb_lcd.h>

#include<Wire.h>


rgb_lcd lcd;

const int colorR=0;
const int colorG=255;
const int colorB=0;
int a;
float temp;
int B=3975;
float resistance;
int button=3;

void setup() {
  // put your setup code here, to run once:
pinMode(button,INPUT);
Serial.begin(9600);
lcd.begin(16,2);

lcd.setRGB(colorR,colorG,colorB);

lcd.print("hello world!");

delay(1000);
}

void loop() {
  // put your main code here, to run repeatedly:
a=analogRead(0);
resistance=(float)(1023-a)*10000/a;
temp=1/(log(resistance/10000)/B+1/298.15)-273.15;
temp=temp+32;
lcd.setCursor(0,1);
int buttonState=digitalRead(button);
if(buttonState==1)
{
lcd.print(temp);
lcd.print("*C");
}
else
{
 lcd.clear();
  }
delay(100);
}

Credits

Rajat Naruka

Rajat Naruka

8 projects • 1 follower

Comments