LCD Confusion - please help

Hi all,

I am using aruino uno.
I am using a code i found online which is used to make an LCD display read the temperature which the temperature sensor detects. The LED's display too, how hot or cold it is by using three levels of below X degrees C, above Y degrees C and in between. The piezo beeps if it is at one of these levels (i think above Y).

However, the Problem:
The LCD screen does not display text or the temperature read, rather, it just lights up.

Here is the code and circuit:

Any Help would be really appreciated!!
Ps. i need to get this done today, thank you.

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int sensorPin = 0;
float tempC;
void setup() {
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(13, OUTPUT);
pinMode(9, INPUT);
lcd.begin(16, 2);
}
void loop() {
tempC = get_temperature(sensorPin);
lcd.setCursor(0,0);
lcd.print("Temperature: ");
lcd.setCursor(0,1);
lcd.print (tempC, 1); lcd.print(" "); lcd.print("C");
delay(200);

if (tempC <= 16){
digitalWrite(8, HIGH);
digitalWrite(7, LOW);
digitalWrite(13, LOW);
noTone(9);

}
else if (tempC > 36){
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(13, HIGH);
tone(9, 700, 250);
delay(2000);

}
else {
digitalWrite(7, HIGH);
digitalWrite(8, LOW);
digitalWrite(13, LOW);
noTone(9);
}

}
float get_temperature(int pin) {
float temperature = analogRead(pin);
float voltage = temperature * 5.0;
voltage = voltage / 1024.0;
return ((voltage - 0.5) * 100);
}

Thanks.

The obvious question is "Have you wired up the LCD correctly ?" Also please post code using </> code-tags and use ctrl-t auto format. and leave 1 line of blank space between functions.

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html . Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Have you tried adjusting the pot that is connected to the LCD display?

Also ;

int sensorPin = 0;

Should be;

 int sensorPin = A0;

Tom... :slight_smile:

int sensorPin = A0;Whilst it makes sense to use the pin numbers/names printed on the Arduino board the analogRead() function will work fine if sensorPin is declared as 0