Web server

Dependencies:   EthernetNetIf mbed HTTPServer

Files at this revision

API Documentation at this revision

Comitter:
nobuki
Date:
Sun Jun 17 03:53:43 2012 +0000
Commit message:
Version 1

Changed in this revision

EthernetNetIf.lib Show annotated file Show diff for this revision Revisions of this file
HTTPServer.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.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.lib	Sun Jun 17 03:53:43 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/donatien/code/EthernetNetIf/#bc7df6da7589
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HTTPServer.lib	Sun Jun 17 03:53:43 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/donatien/code/HTTPServer/#d753966e4d97
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Jun 17 03:53:43 2012 +0000
@@ -0,0 +1,40 @@
+#include "mbed.h"
+#include "EthernetNetIf.h"
+#include "HTTPServer.h"
+
+EthernetNetIf ethif( IpAddr(192,168,1,102), // IP
+                     IpAddr(255,255,255,0), // Subnet mask
+                     IpAddr(192,168,1,1),   // Gateway
+                     IpAddr(192,168,1,1) ); // DNS
+HTTPServer server;
+LocalFileSystem local("local"); // Define local file mount point
+DigitalOut led1(LED1);  // for alive check
+
+int main(void)
+{
+    // EthernetNetIf setup
+    if( ethif.setup() )
+    {
+        return 1;
+    }
+
+    // Mount local file path on web root path
+    FSHandler::mount("/local", "/");
+    // Set web root path handler
+    server.addHandler<FSHandler>("/");
+    
+    // Set http port
+    server.bind(80);
+
+    Timer tm;
+    tm.start();
+    while(1)
+    {
+        Net::poll();
+        if( 1.0 < tm.read() )
+        {
+            led1 = !led1;   // high->low, low->high
+            tm.start();
+        }
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Jun 17 03:53:43 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/737756e0b479