HTTP Server upon new mbed Ethernet Interface. Based on original code by Henry Leinen.

Dependencies:   EthernetInterface mbed-rtos mbed

Fork of HTTP_server by pablo gindel

Revision:
0:fcceff3299be
Child:
1:f0c641cd9bad
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Jul 26 22:05:19 2013 +0000
@@ -0,0 +1,50 @@
+
+#include "mbed.h"
+#include "EthernetInterface.h"
+#include "HTTPServer.h"
+
+LocalFileSystem local("local");
+
+DigitalOut led1(LED1);
+
+void http_thread (void const* arg);                   ///////
+
+int main() {
+   
+    EthernetInterface eth;
+    eth.init(); //Use DHCP
+    eth.connect();
+    printf("IP Address is %s\n", eth.getIPAddress());
+    
+    Timer onesec;
+    onesec.start();
+
+    Thread httpsvr( &http_thread );
+
+    while (true) {
+
+        if (onesec.read() > 1) {
+            onesec.reset();
+            led1 = 1-led1;
+        }
+        
+    }
+    
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////
+//                                            HTTP THREAD                                           //
+//////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void http_thread (void const* arg) {
+
+    HTTPServer svr (80, "/local/");    // esto incluye el init
+
+    // osThreadSetPriority( Thread::gettid() ,  osPriorityBelowNormal );
+
+    while (1) {
+
+        svr.poll();
+
+    }
+}