Thanks for your reply! I'd love some expert have a look at the code in any case! Some of the variable and function names are german, I am afraid. Here it is:
#include <MemoryFree.h>
#include <EEPROM.h>
#include <SD.h> //SD-Karte
#include <SPI.h> //Kommunikation mit Ethernet-Shield
#include <Ethernet.h>
//#include <dht11.h> //Feuchte-Sensor
#include <OneWire.h> //Kommunikation mit Temperatur-Sensoren
#include <DallasTemperature.h> //Temperatur-Sensoren
#include <Wire.h> //I2C für Uhr
#include <DS1307.h> //Uhr-Chip
//#include <Arduino.h>
#define DHT11PIN 2 //Digitaler Pin, an dem DHT11 angeschlossen ist
#define ONE_WIRE_BUS 3 //Digitaler Pin für 1-Wire
// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = {
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = {
192,168,1, 177 };
// Initialize the Ethernet server library (port 80 is default for HTTP)
EthernetServer server(80);
//dht11 feuchtesensor;
OneWire oneWire(ONE_WIRE_BUS); //Instanz für 1-Wire-Device
DallasTemperature tempSensors(&oneWire); //Temperatursensor
int uhrzeit[7];
const int relais1 = 5, relais2 = 6; //Relais für Pumpe auf Pins 5, 6
const char eingabeTaste = 13;
const char tabTaste = 9;
//const char refreshString[] = "<meta http-equiv=\"refresh\" content=\"1; URL=/\">";
boolean nichtGespeichert = true; //fuer minuetliches Speichern
void setup()
{
Serial.begin(9600); //serielle Verbindung über USB starten
Ethernet.begin(mac, ip); // start the Ethernet connection
server.begin(); // Ethernet Server starten
tempSensors.begin(); // 1-Wire-Temperatursensoren starten
pinMode(10, OUTPUT); //fuer SD-Karte: Chip select pin als OUTPUT setzen
while (!SD.begin(4)) { //nur mit SD-Karte geht's weiter!
Serial.println("SD-Karte?!");
delay(200);
};
DDRC|=_BV(2) |_BV(3); // POWER:Vcc Gnd muss was für I2C sein, für die Uhr
PORTC |=_BV(3); // VCC PINC3
//stelleUhr(); //Uhr nur einmal stellen!!
pinMode(relais1, OUTPUT); //Pin für relais1
pinMode(relais2, OUTPUT); //Pin für relais2
}
void loop()
{
RTC.get(uhrzeit,true); //Uhrzeit einlesen
if (uhrzeit[0]<30 && nichtGespeichert) { //einmal in der Minute
//readDHT11(); //DHT11-Feuchtesenser lesen und schreiben
tempSensors.requestTemperatures(); // 1-Wire lesen
werteSpeichern(); //Daten mit Zeitstempel speichern
nichtGespeichert = false;
}
else if (uhrzeit[0]>=30) nichtGespeichert = true;
webServer();
controlHeater();
}
void controlHeater()
{
float tempSollTag = changeTemp("h/tetag.htm",'=');
float tempSollNacht = changeTemp("h/tenac.htm",'=');
float tempSollWasser = changeTemp("h/tewas.htm",'=');
DeviceAddress tempHV={ 0x28, 0x99, 0x88, 0x4A, 0x03, 0x00, 0x00, 0xD3 };
DeviceAddress tempHR={ 0x28, 0x99, 0x87, 0xAD, 0x02, 0x00, 0x00, 0xD8 };
DeviceAddress tempSpeicherOben ={ 0x28, 0x86, 0x5A, 0x08, 0x03, 0x00, 0x00, 0x96 };
DeviceAddress tempSpeicherMitte={ 0x28, 0x71, 0x4C, 0x08, 0x03, 0x00, 0x00, 0x81 };
DeviceAddress tempSpeicherUnten={ 0x28, 0xCA, 0x75, 0x08, 0x03, 0x00, 0x00, 0x09 };
DeviceAddress tempAussen={ 0x28, 0xD8, 0xC1, 0xAD, 0x02, 0x00, 0x00, 0xEF };
}
void webServer()
{
EthernetClient client = server.available(); // listen for incoming clients
if (client)
{
// an http request ends with a blank line
char* anfrage="h/12345.678";
int zeichenzaehler=0;
while (client.available()) {
char charVomClient = client.read();
if ((zeichenzaehler++ >= 5) &&(zeichenzaehler <=14))
anfrage[zeichenzaehler-4] = charVomClient; //Zeichen 12345.678 nach anfrage
Serial.print(charVomClient);
}
Serial.println();
Serial.print("Anfrage: ");
Serial.println(anfrage);
if (anfrage[2]=='_') //"te*"=temperatur or "ta*"=tag
{
if (anfrage[3]=='t') //Temperatur
{
char upDown=anfrage[6]; //'+' or '-'
switch (anfrage[4])
{
case 't': //Tag
anfrage="h/tetag.htm";
break;
case 'n': //Nacht
anfrage="h/tenac.htm";
break;
case 'w': //Wasser
anfrage="h/tewas.htm";
}
changeTemp(anfrage, upDown);
sendFile(client, anfrage);
}//if
else //Zeiten
{
boolean hour = (anfrage[6]=='h' || anfrage[6]=='i'); // !hour == minute
boolean up = (anfrage[6]=='m' || anfrage[6]=='h'); // !up == down
boolean startTime = (anfrage[5]=='s');
char heizzeit = anfrage[4];
boolean deleteTime = (anfrage[5]=='x');
switch (anfrage[3])
{
case '1':
anfrage="h/tamoX.htm";
break;
case '2':
anfrage="h/tadiX.htm";
break;
case '3':
anfrage="h/tamiX.htm";
break;
case '4':
anfrage="h/tadoX.htm";
break;
case '5':
anfrage="h/tafrX.htm";
break;
case '6':
anfrage="h/tasaX.htm";
break;
case '7':
anfrage="h/tasoX.htm";
}
anfrage[6]=heizzeit;
if (deleteTime) setTimeToND(anfrage);
else changeTime(anfrage, startTime, hour, up);
sendFile(client, anfrage);
}
}
else
{
if (anfrage[2]==' ') anfrage="h/index.htm";
if (anfrage[8]=='t') anfrage="log.txt";
sendFile(client, anfrage); //alle sonstigen Anfragen
};
delay(1); //Zeit für die TCP-Übermittlung
client.stop(); // close the connection
}
}
/*void readDHT11(void)
{
int chk = feuchtesensor.read(DHT11PIN); //liest DHT11
switch (chk) //Fehlerbehandlung für DHT11
{
case 0:
break;
case -1:
Serial.println("DHT11: C err"); //checksum
break;
case -2:
Serial.println("DHT11: T err"); //timeout
break;
default:
Serial.println("DHT11: err");
break;
}
}*/