Temperature and Humidity sensor with LCD display.ino
Temperature and Humidity sensor with LCD display.ino
#include <LiquidCrystal.h>
#include <SimpleDHT.h>
int pinDHT11 = 6;
SimpleDHT11 dht11;
void setup() {
// Don't forget to choose 9600 at the port screen
Serial.begin(9600);
lcd.begin(16, 2);
void loop() {
//These serial codes are for getting readings on the port screen aswell as the
LCD display, since they'll offer us a more detailed interface
Serial.println("=================================");
Serial.println("DHT11 readings...");
byte temperature = 0;
byte humidity = 0;
int err = SimpleDHTErrSuccess;
//This bit will tell our Arduino what to do if there is some sort of an error
at getting readings from our sensor
if ((err = dht11.read(pinDHT11, &temperature, &humidity, NULL)) !=
SimpleDHTErrSuccess) {
Serial.print("No reading , err="); Serial.println(err);delay(1000);
return;
}
Serial.print("Readings: ");
Serial.print((int)temperature); Serial.print(" Celcius, ");
Serial.print((int)humidity); Serial.println(" %");
delay(750);
}