Arduino, lcd programming

Can anyone provide me with a working sketch to make an Arduino Uno work with a DHT11 and an LCD 1602. I am trying to display Temp and Humidity and want to be able to collect samples from 5 green houses. I am using four data lines for LCD and collecting data from DHT11 on (A0).I have been trying for 2 weeks to learn C++ and every time I view another tutorial I get more confused. I would appreciate any help you can give me. This question may have been asked before, but what I found just confused me more. Thank you Gene

Can anyone supply me with a working sketch for an UNO with DHT11 and LCD 1602 to measure Temp and Humidity for 5 green houses. I have four data lines wired on LCD and using data line (A0) for input from sensor. After watching several tutorials, I am more confused than ever. I can"t find an answer in this forum. If anyone can help. I would really appreciate it. Thank you. Gene

(deleted)

The internet is littered with such examples:

arduino dht11 / lcd 1602

Cross post of http://forum.arduino.cc/index.php?topic=548558.0

have you checked links like these?

http://www.circuitbasics.com/how-to-set-up-the-dht11-humidity-sensor-on-an-arduino/

this one actually sound like wat trying to do!

In the reply post, will you please show you codes which you have executed to check that the LCD is functional? This is to test you that you will do follow up with the codes that the Forum members are going to place to help you.

I have four data lines wired on LCD

OK! You have four data lines with the LCD. How many signal wires (excluding the power+VA lines) have you connected with the LCD?

OK! You have four data lines with the LCD. How many signal wires (excluding the power+VA lines) have you connected with the LCD?

Please be kind and put your money where your mouth is.

LCD1602 is a FOUR WIRES device

Not everybody here wants to be a computer expert so enough of this naive and pushy teaching attitude.

Live and let live.

To the OP - sorry old man but do not do Arduino to give you code. As suggested Google for LCD with I2C interface - there should be examples somewhere.

The code below works, but unfortunately it’s for an I2C LCD not the 4 data line one you have. So you will need to use the correct library and begin() for your LCD, but the structure of the sketch should be ok for what you want to do.

But have you got your LCD working without the DHT, doing the normal Hello world thing?

#include <dht11.h>
dht11 DHT;
#define DHT11_PIN 5

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);

void setup() {
  lcd.begin();
  lcd.backlight();
  lcd.print("DHT11 test");
  delay(2000);
  lcd.clear();
}

void loop() {
  DHT.read(DHT11_PIN);    // READ DATA

  lcd.setCursor(0, 0); //along, down
  lcd.print("Temp:");
  lcd.print(DHT.temperature);
  lcd.print((char)223); //degree symbol
  lcd.print("C  RH:");
  lcd.print(DHT.humidity);

  delay(1000);
}

Thanks for the help people. Won't bother you anymore. Greenhouse

This post may work as a tutorial to operate UNO-DHT11-PLCD setup:
1. Let us make connections among UNO-PLCD-DHT11 as per following layout diagram.

2. Let us upload the following program (IDE Example is edited)

#include <SimpleDHT.h>
#include<LiquidCrystal.h>
LiquidCrystal lcd(8, 9, 10, 11, 12, 13);

int pinDHT11 = A0;  //Humidity DATA line at A0-pin of UNO
SimpleDHT11 dht11;  //object is created from class

// read without samples.
byte temperature = 0;
byte humidity = 0;
int err = SimpleDHTErrSuccess;

void setup()
{
  Serial.begin(9600);
  lcd.begin(16, 2);
  lcd.setCursor(0, 0); //Top Line
  lcd.print("Humidity: ");
  lcd.print("Temp:");
}

void loop()
{
  dht11.read(pinDHT11, &temperature, &humidity, NULL);

  lcd.setCursor(0, 1);  //DP0-position bottom line
  lcd.print((int)humidity);
  lcd.print("%");
  //-------------------------

  lcd.setCursor(10, 1);  //DP-10 position bottom line
  lcd.print((int)temperature);
  lcd.write(0xDF);
  lcd.print('C');


  // DHT11 sampling rate at 2-sec interval
  delay(2000);
}

3. Check that LCD is showing the humidity and temperature readings.

4. Give a blow on the DHT11 sensor from mouth; observe that humidity reading changes.

5. Modify the program of Step-2 so that the readings appear as floating point number (two digit after decimal point).

(deleted)

232: OK! You have four data lines with the LCD. How many signal wires (excluding the power+VA lines) have you connected with the LCD?

Please be kind and put your money where your mouth is.

LCD1602 is a FOUR WIRES device

Not everybody here wants to be a computer expert so enough of this naive and pushy teaching attitude.

Live and let live.

To the OP - sorry old man but do not do Arduino to give you code. As suggested Google for LCD with I2C interface - there should be examples somewhere.

@232 - can you cut out the Kerouac-style "stream of unconciousness" posts? Maybe learn how to use quote tags? At the same time, take a moment to read the original statement of the problem

I have four data lines wired on LCD

Now, common 44xxx LCDs have a four data line mode, but still require enable/clock, register select and R/W lines, as well as power. Perhaps the OP's description of their LCD as as 1602 was mistaken - it is always good to question, to seek clarification, and avoid time-wasting doubts.