test

Dependencies:   EthernetNetIf mbed

Fork of HTTPServer by Donatien Garnier

Files at this revision

API Documentation at this revision

Comitter:
y_notsu
Date:
Wed Jan 23 12:39:09 2013 +0000
Parent:
6:d753966e4d97
Child:
8:2b1867fdf78f
Commit message:
Networking test

Changed in this revision

EthernetNetIf_copy.lib Show annotated file Show diff for this revision Revisions of this file
main.c Show annotated file Show diff for this revision Revisions of this file
mbed_copy.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/EthernetNetIf_copy.lib	Wed Jan 23 12:39:09 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/donatien/code/EthernetNetIf/#bc7df6da7589
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.c	Wed Jan 23 12:39:09 2013 +0000
@@ -0,0 +1,39 @@
+#include "mbed.h"
+#include "EthernetNetIf.h"
+#include "HTTPServer.h"
+ 
+EthernetNetIf eth;  
+HTTPServer svr;
+ 
+DigitalOut led1(LED1);
+ 
+int main() {
+  printf("Setting up...\n");
+  EthernetErr ethErr = eth.setup();
+  if(ethErr)
+  {
+    printf("Error %d in setup.\n", ethErr);
+    return -1;
+  }
+  printf("Setup OK\n");
+  
+  svr.addHandler<SimpleHandler>("/"); //Default handler
+  svr.bind(80);
+  
+  printf("Listening...\n");
+    
+  Timer tm;
+  tm.start();
+  //Listen indefinitely
+  while(true)
+  {
+    Net::poll();
+    if(tm.read()>.5)
+    {
+      led1=!led1; //Show that we are alive
+      tm.start();
+    }
+  }
+  
+  return 0;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed_copy.bld	Wed Jan 23 12:39:09 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e
\ No newline at end of file