I have a DHT22 hooked up fine and sending to serial but when I try to get it to work with a lcd display, it doesnt display any temperature or humidity readings just: Humidity 0.00% and Temp. 0.00*c.
Here is the code I am using:
#include “DHT.h” //includes lib for the humdity sensor
#include <LiquidCrystal.h> //lcd lib
#define DHTPIN 2 //pin that DHT is connected to
#define DHTTYPE DHT22 //Sensor we are using
DHT dht(DHTPIN, DHTTYPE); //defines location for DHT
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
// set up the LCD’s number of rows and columns:
lcd.begin(16, 2);
}
void loop() {
float h = dht.readHumidity(); //defines the variable for humidity
float t = dht.readTemperature(); //defines the variable for temperature
// set the cursor to column 0, line 0
lcd.setCursor(0,0);
// print the humidity
lcd.print("Humidity “);
lcd.print(h);
lcd.print(” % ");
//move line down
lcd.setCursor(0,1);
lcd.print(“Temp. “);
lcd.print(t);
lcd.print(” *C”);
delay(2000); //wait two sec. before taking another reading.
}
Any help would be appreciated.