Rahul Bhatia
Published © GPL3+

Display Room Temperature on LCD

When we press the push button connected to Arduino, temperature will be displayed on LCD screen.

BeginnerShowcase (no instructions)2,133
Display Room Temperature on LCD

Things used in this project

Code

LCD screen display code

Java
temperature will be displayed on LCD screen
#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

Rahul Bhatia
8 projects • 0 followers
Btech student 3rd year

Comments