Please am trying to read temperature values with a DHT11 Temperature and humidity sensor to read temperature within 0-100 degree celcius, I have set up my circuit with the below code but output read on the LCD screen is within the range of 470. please how can I go about it.
#include <LiquidCrystal.h>
LiquidCrystal lcd(10,9,5,4,3,2);
int tempPin = A0;
float tempVal;
void setup() {
Serial.begin(9600);
lcd.begin(16,2);
lcd.setCursor(0,0);
lcd.print("Temperature"); // put your setup code here, to run once:
}
void loop() {
tempVal= analogRead(tempPin);
float celcius=(5*tempVal*100)/1024;
lcd.setCursor(0,1);
lcd.print(celcius);
Serial.print(celcius);
// put your main code here, to run repeatedly:
}