Can't get ethernet shield to work :(

Frustrated. Ran the code from this website:

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

// the media access control (ethernet hardware) address for the shield:
byte mac = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
//the IP address for the shield:
byte ip = { 10, 0, 0, 177 };

void setup()
Ethernet.begin(mac, ip);

void loop () {}

I can see the shield is getting an ip address, but when I try to connect to it using iDK and Arduino CTRL on my iPhone I can’t connect to it. I’m connecting locally via WIFI and using port 80.

Any suggestions?

Well, I honestly have no idea what you’re trying to do here. However, forgetting about “wifi” and an “iphone”, if you can connect your ethernet shield to a local router via CAT5 cable, you can try my sketch here. I just wrote it today, and don’t know much as yet, but it works great and tells me all about my local network. If what you really have is a Wifi shield, then never mind.

file:  LocalIP_test1
date:  07/17/13 (orig 07/17/13).
author: oric_dan.

status: works good.

This program gets IP information from the local router 
the Arduino Ethernet shield is connected to using DHCP.

Note - once the IP info is obtained, it should be possible
  to connect a PC to the router via wifi, and use Windows 
  "Start > Run > cmd" to ping the dnsserver, router, and 
  Ethernet shield using, for instance, "ping",
  to find the hardware on the local network.

1. PC/notebook USB port should be able to provide enough 
   current to power UNO or Mega2560 board and the Ethernet 
2. on UNO or Mega2560 board, just plug in Ethernet shield.
3. connect Ethernet shield to router via CAT5 cable.
1. Enter MAC address for the Ethernet shield below if known. 
    Ethernet shields may have a MAC address printed on the shield,
    but anything will do, as long as it's unique for the local 
2. on power up, PWR,Link,100M,FULLD leds should light on the 
   Ethernet shield.
3. if connection goes correctly, then Rx,Tx,Link leds on the 
   Ethernet shield will blink during data download from router.
4. local shields will commonly be assigned an IP address such as 

File References
1. for our machine, ".." refers to Arduino IDE directory 
2. IPAddress.h located in ..\hardware\arduino\cores\arduino
3. Ethernet.h located in ..\libraries\Ethernet

Based on a program found in the Arduino Cookbook.

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

// **** Program name ****
char *progname = "\nIP-Interrogate ...";

// ethernet params - uses default MAC address, should
//   be changed to unique for specific ethernet shield.
byte mac[] = { 0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 };

void setup() 
  Serial.begin(57600);  // 230400);
//  while (!Serial) {
//    ; // wait for serial port to connect. Needed for Leonardo only
//  }
  Serial.println( progname );
  Serial.println(">configuring Ethernet using DHCP");

void loop()

void setup_Ethernet()
  int ret=0;
  // start the Ethernet connection:
  if( (ret=Ethernet.begin(mac)) == 0) {
    Serial.println(">>Failed to configure Ethernet using DHCP ");
    // no point in carrying on, so do nothing forevermore:
  // give the Ethernet shield a second to initialize:
//  delay(1000);

void display_IPinfo()
  IPAddress ipa, submask, gateip, srvrip;

  Serial.println("DNS Server");
  srvrip = Ethernet.dnsServerIP();
  Serial.print("- dnsServerIP = ");
  gateip = Ethernet.gatewayIP();
  Serial.print("- gatewayIP   = ");
  Serial.println("Ethernet shield:");  
  ipa = Ethernet.localIP();
  Serial.print("- IP Address  = ");
  submask = Ethernet.subnetMask();
  Serial.print("- subnetMask  = ");

void display_mac()
  int i;
  Serial.print("Ethernet shield MAC = ");  
  for( i=0; i<5; i++) {
    Serial.print( mac[i], HEX );
    Serial.print(", ");
  Serial.print( mac[i], HEX );

void endless_loop()
  Serial.println("\n>going into endless loop now - goodbye");

Yeah disregard all of this, I have no idea what I am doing but I was totally doing it wrong anyhow.

You need to specify just what type of Ethernet shield you are using. There are several different types.

I can see the shield is getting an ip address, but when I try to connect to it using iDK and Arduino CTRL on my iPhone I can’t connect to it. I’m connecting locally via WIFI and using port 80.

Any suggestions?

Since you’re not setting the gateway and network mask, you could get some networking problems. If you’re router has DHCP enabled (most routers do), you could try making the Ethernet shield get an ip, by not specifying the IP:

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

Adapted from:

byte mac[] = { 0x90, 0xA2, 0xDA, 0x0E, 0x99, 0x4A };

void setup() {
  if(Ethernet.begin(mac) == 0) {
     Serial.println("Could not configure Ethernet using DHCP");
  } else {

void loop() {