Hallo Forum,
leider muss ich euch jetzt ein wenig aufn Keks gehen mit meinem EthernetShield.
Und zwar habe ich jetzt einen Sketch geschrieben der alle 100 Sekunden ein Request absendet, leider wird das ganze nur zweimal ausgeführt und ich verstehe nicht warum.
mfg
Ballibum
#include <SPI.h>
#include <Ethernet.h>
// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = { 0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 };
char serverName[] = "www.hemitheconyx-caudicinctus.de";
// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;
void setup() {
Serial.begin(9600);
// start the Ethernet connection: Okay, hier geht also alles los, mein Ethernet Shield wird "hochgefahren"
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
// no point in carrying on, so do nothing forevermore: // wenn nicht pasiert fährt es sich runter????
while(true);
}
// give the Ethernet shield a second to initialize:
delay(1000);
Serial.println("connecting...");
// if you get a connection, report back via serial:
if (client.connect(serverName, 80)) { //Hier wird eine Verbindung zur Homepage/Server aufgebaut
Serial.println("connected");
}
else {
// if you didn't get a connection to the server: //Hier wird mir gesagt, dass es nicht geklappt hat
Serial.println("connection failed");
}
}
void loop()
{
if(client.connected()) //wenn eine Connection besteht soll folgendes ausgeführt werden:
{
Serial.println("bin connected");
client.println("GET /hc_arduino_php/hc_terrao_01.php?temperatur=340&luftfeuchtigkeit=560 HTTP/1.0");
client.println("Host: www.hemitheconyx-caudicinctus.de");
client.println();
}
// if the server's disconnected, stop the client: //Warum geht der Arduino in diese Schleife
if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop(); //hier wird der client runtergefahren
// do nothing forevermore:
while(true);
}delay(100000);
}