I can't connect to my Etherten is something wrong with the code or the browser?

The code compiles in arduino 1.0 and uploads but when i connect to it through my browsers(firefox and internet explorer) it says internet exploerer cannot display the webpage and on firefox its just blank.

here is the code

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = {
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = {
  192,168,2, 77 };

EthernetServer server(80);

int LED = 15;//Analog pin 5 (yes it works as a digital pin too)

void setup()
  Ethernet.begin(mac, ip);
  pinMode(LED, OUTPUT);

#define BUFSIZ 100    //Buffer size for getting data
char clientline[BUFSIZ];  //string that will contain command data
int index = 0;  //clientline index
void loop()
  index=0;  //reset the clientline index
  EthernetClient client = server.available();
  if (client) {
    boolean currentLineIsBlank = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        if(index<BUFSIZ)  //Only add data if the buffer isn't full.
        if (c == '\n' && currentLineIsBlank)
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println("<h1><center>Arduino Home Automation</h1></center><br><center><form method=get action=/?><input type=radio name=L1 value=1>Relay1 On<input type=radio name=L1 value=0>Relay1 Off<br><input type=submit value=submit></form></center>");
        if (c == '\n') {
          currentLineIsBlank = true;
        else if (c != '\r') {
          currentLineIsBlank = false;
        if(strstr(clientline,"/?L1=1")!=0) {  //look for the command to turn the led on.
          digitalWrite(LED, 1);  //turn the led on
        } else if(strstr(clientline,"/?L1=0")!=0) {  //look for command to turn led off.
          digitalWrite(LED, 0);  //turn led off

Thanks in advance

Kiwi_John5 years ago
I had some similar problems, solved by plugging in an external power supply as well as the USB cable from my computer.
Deez20095 years ago
I had a similar problem with an Uno and Ethernet Shield, and after pulling all my hair out, i decided to recompile and upload using .22 instead of .23 of the IDE, and that solved my problem. Have you tried that?