LCD Display will nicht funktionieren

Hey Leute,

ich habe diesen Sketch hier geschrieben, er funktioniert auch und setzt einen Webserver auf,
leider möchte ich die Werte auch noch auf einem LCD Display anzeigen lassen.
Komischerweise funktioniert das nicht..
Kann mir jemand helfen?

/*
Web Server

A simple web server that shows the value of the analog input pins.
using an Arduino Wiznet Ethernet shield.

Circuit:

  • Ethernet shield attached to pins 10, 11, 12, 13
  • Analog inputs attached to pins A0 through A5 (optional)

created 18 Dec 2009
by David A. Mellis
modified 9 Apr 2012
by Tom Igoe

*/

#include <SPI.h>
#include <Ethernet.h>
#include "DHT.h" //von ladyada: GitHub - adafruit/DHT-sensor-library: Arduino library for DHT11, DHT22, etc Temperature & Humidity Sensors
#define DHTPIN 8 // benutzter ARDUINO-Pin (Analog-Pin 1)
#include <Servo.h>
#include <LiquidCrystal.h>
#include <SPI.h>
#include <Ethernet.h>
#include <math.h>
#include <EEPROM.h>

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = { // Beschreibung des Ethernet Shields, steht auf der Rückseite!
0x90, 0xA2, 0xDA, 0x0E, 0xB, 0x76
};
IPAddress ip(192,168,0,2); // Ip des Arduinos oder des Servers????
EthernetServer server(80);

LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // diese Pins werden benutzt

#define DHTTYPE DHT11 // DHT 11

DHT dht(DHTPIN, DHTTYPE);
Servo myservo;

void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}

// start the Ethernet connection and the server:
Ethernet.begin(mac, ip);
server.begin();
Serial.print("server is at ");
Serial.println(Ethernet.localIP());
Serial.println("DHT11-Test");
Serial.begin(9600);
myservo.attach(9);

lcd.clear(); // LCD löschen
lcd.begin(16, 2); // verfügbare Spalten und Zeilen

dht.begin();
float h = dht.readHumidity();
float t = dht.readTemperature();

}

void loop() {
float h = dht.readHumidity();
float t = dht.readTemperature();
if (isnan(t) || isnan(h))
{
Serial.println("Fehler beim Lesen vom DHT-Sensor");
}
else
{
// listen for incoming clients
EthernetClient client = server.available();
if (client) {
Serial.println("new client");
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
Serial.write(c);
// if you've gotten to the end of the line (received a newline
// character) and the line is blank, the http request has ended,
// so you can send a reply
if (c == '\n' && currentLineIsBlank) {
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connection: close"); // the connection will be closed after completion of the response
client.println("Refresh: 5"); // refresh the page automatically every 5 sec
client.println();
client.println("");
client.println("");
// output the value of each analog input pin
{

client.print("INFO 1 - Simuliertes Badezimmer"); // send these lines to the client.
client.println();
client.println("
");
client.print("Temperatur: ");
client.print(t);
client.print(" *C");
client.println();
client.println("
");
client.print("Luftfeuchtigkeit: ");
client.print(h);
client.print(" %");

}
client.println("");
break;
}
if (c == '\n') {
// you're starting a new line
currentLineIsBlank = true;
}
else if (c != '\r') {
// you've gotten a character on the current line
currentLineIsBlank = false;
}
}
}
// give the web browser time to receive the data
delay(1);
// close the connection:
client.stop();
Serial.println("client disonnected");
}
}
Serial.print("Feuchtigkeit: ");
Serial.print(h);
Serial.print(" %\t ");
Serial.print("Temperatur: ");
Serial.print(t);
Serial.println(" Grad Celsius");

lcd.setCursor(0,0);
lcd.print("Feuchtigk.:");
lcd.print(h);
lcd.setCursor(0,1);
lcd.print("Temperatur:");
lcd.print(t);

if (t > 30 || h > 50) {
myservo.write(45);
} else
{
myservo.write(0);}
delay (2000);}

Hier auch nochmal ein Sketch ohne Webserver, bei dem der LCD Display die gewünschten Daten anzeigt.

#include "DHT.h" //von ladyada: GitHub - adafruit/DHT-sensor-library: Arduino library for DHT11, DHT22, etc Temperature & Humidity Sensors
#define DHTPIN 8 // benutzter ARDUINO-Pin (Analog-Pin 1)
#include <Servo.h>
#include <LiquidCrystal.h>
#include <SPI.h>
#include <Ethernet.h>
#include <math.h>
#include <EEPROM.h>

byte mac[] = { // Beschreibung des Ethernet Shields, steht auf der Rückseite!
0x90, 0xA2, 0xDA, 0x0E, 0xB, 0x76
};
IPAddress ip(192,168,0,2); // Ip des Arduinos oder des Servers????

LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // diese Pins werden benutzt

#define DHTTYPE DHT11 // DHT 11

DHT dht(DHTPIN, DHTTYPE);
Servo myservo;

void setup() {
Serial.begin(9600);
Serial.println("DHT11-Test");
Serial.begin(9600);
myservo.attach(9);

lcd.clear(); // LCD löschen
lcd.begin(16, 2); // verfügbare Spalten und Zeilen

dht.begin();
}

void loop() {
// Das Erfassen von Temperatur und Luftfeuchtigkeit benoetigt ca. 250 Millisekunden.
float h = dht.readHumidity();
float t = dht.readTemperature();

// Check, ob die Daten Zahlen sind, falls nicht (NaN: not a number), ist was falsch gelaufen!
if (isnan(t) || isnan(h))
{
Serial.println("Fehler beim Lesen vom DHT-Sensor");
}
else
{

Serial.print("Feuchtigkeit: ");
Serial.print(h);
Serial.print(" %\t ");
Serial.print("Temperatur: ");
Serial.print(t);
Serial.println(" Grad Celsius");

lcd.setCursor(0,0);
lcd.print("Feuchtigk.:");
lcd.print(h);
lcd.setCursor(0,1);
lcd.print("Temperatur:");
lcd.print(t);

if (t > 30 || h > 50) {
myservo.write(45);
} else
{
myservo.write(0);}
delay (2000);
}
}

Könnte es daran liegen, dass ich dann das aufgesteckte Ethernet Shield verwende?

Ich danke euch..

Liegt daran, das das Ethernet Shield auch Pin 11 und 12 als SPI verwendet.

Nimm andere Pins Für das LCD, aber nicht 0, 1, 13. Besser, du schaust nach, welche Pins schon anderweitig benutzt werden.

Vielen Dank für dich Hilfe !!!

Oder verwende für das Display I2C, sind nur 2 Adern an A4 und A5.

Damit sind die anderen frei.

Du brauchst dann nur einen I2C-Adapter wie diesen:

Und bitte auch hier den Code in Code-Tags setzen, danke.