Hi there-
I'm new to arduino, and programming/electronics in general. I received an arduino and a seeedstudio starter kit along with some various sensors as a gift a couple months ago, and I've been tinkering with it since.
Anyways, I've been trying to make a temperature and humidity gauge using the DHT22 sensor and 16 x 2 LCD display. Here is my code:
#include <SerialLCD.h>
#include <SoftwareSerial.h>
#include "DHT.h"
#define DHTPIN A0
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
SerialLCD slcd(11,12);
int t=0;
int h=0;
void setup() {
slcd.begin();
Serial.begin(9600);
slcd.backlight();
}
void loop() {
float h = dht.readHumidity();
float t = ((dht.readTemperature()*1.8)+32);
if (isnan(t) || isnan(h))
{
Serial.println("Failed to read from DHT");
}
else
{
Serial.print("Humidity: ");
Serial.print(h);
Serial.print(" %\t");
Serial.print("Temperature: ");
Serial.print(t);
Serial.println(" *F");
}
slcd.home();
slcd.print(" TEMP: ");
slcd.print(t);
slcd.setCursor(0,1);
slcd.print("HMDTY: ");
slcd.print(h);
}
And here is my problem, the LCD does not display the sensor readings, just random characters:
https://drive.google.com/file/d/0B1Kkf4HgZKj4MkVTd2d6Qm5qRVE/edit?usp=sharing
I can tell the problem is not the sensor, when I check the serial monitor i get good readings:
https://drive.google.com/file/d/0B1Kkf4HgZKj4dXhiWFhjLUdEM0U/edit?usp=sharing
I'm not sure if this would be useful, but here are the wiki's for the sensor and the display:
http://www.seeedstudio.com/wiki/index.php?title=Grove_-_Serial_LCD_V1.0
http://www.seeedstudio.com/wiki/Grove_-_Temperature_and_Humidity_Sensor_Pro
I was hoping someone could point in the right direction to fix it. Like I said, I'm pretty new to this, I have a feeling I'm missing something basic, but this problem has stumped me for awhile now.
Thanks-
Trey Chaffin