Few weeks ago I’ve bought a LCD 16x2 display. I wanted to create a room temperature sensor.
I’ve been using pocket arduino and there’s been some issues with resetting. I had to burn bootloader once again, so it took me longer to make this post. Also I’ve picked LM35 for this project (cool but expensive), but I’ve burned it. So I was forced to go with LM335 (not that cool but cheap). You can download code and watch video below.
Code :
#include <LiquidCrystal.h>
float raw;
float temperature;
LiquidCrystal lcd(3, 4, 5, 6, 7, 8);
byte degree[8] =
{
B01100,
B10010,
B10010,
B01100,
B00000,
B00000,
B00000,
B00000
};
void setup()
{
lcd.begin(16, 2);
lcd.print("Temperature :");
lcd.createChar(0, degree);
lcd.setCursor(7,1);
lcd.write(0);
lcd.setCursor(8,1);
lcd.print("C");
}
void loop()
{
raw = analogRead(0);
temperature = ((raw*480.0/1024.0)-273);
lcd.setCursor(1,1);
lcd.print(temperature);
delay(500);
}