My Ethernet shield stop responding after some hours and needs restart with the restart button
is this hardware related?
Second question is PWM pin (4) occupied by the SD card , i dont use SD card , but i need the Pin 4 for some other purposes.
void StartWeb()
{
EthernetClient client = server.available();
if (client) {
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
// serch parameter from "HTTP GET"
if(gflag){
if(c != ' '){
parm += c;
}else{
gflag = false;
}
}
if(c == '?' && parm == ""){
gflag = true;
if (c == '\n' && currentLineIsBlank) {
// send a standard http response header
if(parm == ""){ // normal HTTP access
client.println(F("HTTP/1.1 200 OK"));
client.println(F("Content-Type: text/html"));
client.println(F(""));
client.println(F("<html><head></head><body>HELLO!</body></html> "));
break;
}
else{ // using XMLhttpObject access
//IF SUBMIT FROM TIME
client.println(F("HTTP/1.1 200 OK"));
client.println(F("Content-Type: text/html"));client.println(F(""));
int check = parm.indexOf('=');
if(check != -1){
//TIME
if (hrs < 10) client.print(F("0"));client.print( hrs );client.print(":");if (mins < 10) client.print(F("0"));client.print(mins);client.print(F(":"));if (secs < 10) client.print(F("0"));
client.print(secs);client.print(F(" "));if (date < 10) client.print(F("0"));client.print(date);client.print(F("-"));if (month < 10) client.print("0");client.print(month);client.print(F("-"));if (year < 10)client.print(F("0"));client.println(year);
}
}
parm = "";
}
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();
}///////
}