Example program for the Ethernet Shield V2.0 by SeeedStudio. The example gets an IP address via DHCP and then requests http://mbed.org/media/uploads/mbed_official/hello.txt

Dependencies:   WIZ820ioInterface mbed

Revision:
3:2d0986d5542e
Parent:
2:3b6c391a682d
Child:
4:14045b8557cb
--- a/main.cpp	Fri Apr 11 13:25:01 2014 +0000
+++ b/main.cpp	Fri Apr 11 16:24:53 2014 +0000
@@ -8,9 +8,9 @@
  * D12 - MISO pin
  * D13 - SCK pin
  * D10 - SEL pin
- * NC - Reset pin
+ * NC - Reset pin; use D5 otherwise the shield might get into reset loop
  */
-WIZ820ioInterface eth(D11, D12, D13, D10, NC);
+WIZ820ioInterface eth(D11, D12, D13, D10, D5);
 
 int main()
 {
@@ -20,29 +20,29 @@
     // If no param is passed to init() then DHCP will be used on connect()
     int s = eth.init();
     if (s != NULL) {
-        pc.printf(">>> Could not initialise. Halting!\n");
+        printf(">>> Could not initialise. Halting!\n");
         exit(0);
     }
 
-    pc.printf(">>> Get IP address...\n");
+    printf(">>> Get IP address...\n");
     while (1) {
         s = eth.connect(); // Connect to network
 
         if (s == false || s < 0) {
-            pc.printf(">>> Could not connect to network. Retrying!\n");
+            printf(">>> Could not connect to network. Retrying!\n");
             wait(3);
         } else {
             break;
         }
     }
-    pc.printf(">>> Got IP address: %s\n", eth.getIPAddress());
+    printf(">>> Got IP address: %s\n", eth.getIPAddress());
 
     // Prepare the http request to mbed.org
     char http_cmd[] = "GET /media/uploads/mbed_official/hello.txt HTTP/1.0\n\n";
     TCPSocketConnection sock;
     sock.connect("mbed.org", 80);    
     sock.send_all(http_cmd, sizeof(http_cmd)-1);
-    pc.printf(">>> Sent request to mbed.org\n");
+    printf(">>> Sent request to mbed.org\n");
 
     // Read the response
     char buffer[300];
@@ -52,7 +52,7 @@
         if (ret <= 0)
             break;
         buffer[ret] = '\0';
-        pc.printf(">>> Received %d chars from mbed.org:\n%s\n", ret, buffer);
+        printf(">>> Received %d chars from mbed.org:\n%s\n", ret, buffer);
     }
     sock.close();