Guys I wrote a very simple program (just got the shield :)) and the webpage is not displaying? I was thinking it may be an issue with the default IP gateway? Mine is 192.168.0.1, whilst I think the default is 192.168.1.1. Anyway, its not a problem with the HTML coding as the page does not respond. I tried the basic example one (the one provided with the IDE) and nothing.
Here is my current code:
#include <SPI.h>
#include <Ethernet.h>
int led=8;
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = {192, 168, 5, 177};
EthernetServer server(80);
String readString;
void setup(){
Serial.begin(9600);
pinMode(led,OUTPUT);
Ethernet.begin(mac, ip);
Serial.print("Server is Up");
}
void loop(){
EthernetClient client = Serial.available();
if(client){
while(client = client.connected()){
if(client = client.available()){
char c = client.read();
readString += c;
Serial.print(c);
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println();
client.println("<HTML>");
client.println("<h1>");
client.println("<TITLE>client's LED Control</TITLE>");
client.println("</h1>");
client.println("<BODY bgcolor='green'>");
client.println("
");
client.println("<a href=\"/?lighton\"\">client ON</a>");
client.println("<a href=\"/?lightoff\"\">client OFF<a>");
client.println("</BODY>");
client.println("</HTML>");
if(readString.indexOf("?lighton" > 0)) digitalWrite(led,HIGH);
if(readString.indexOf("?lightoff" > 0)) digitalWrite(led,LOW);
delay(10);
}
}
}
}