Embedded web server

Dependencies:   EthernetNetIf HTTPServer SDFileSystem mbed

Fork of webserver by Nobuki HIRAMINE

This web server serves pages from an SD card and supports RPC calls for the PWM and GPIO

Revision:
1:73dceccbf2d8
Parent:
0:275cd7ae0902
Child:
2:1b0698a65c62
--- a/main.cpp	Sun Jun 17 03:53:43 2012 +0000
+++ b/main.cpp	Sun Feb 17 08:56:35 2013 +0000
@@ -1,38 +1,41 @@
 #include "mbed.h"
+#include "SDFileSystem.h"
 #include "EthernetNetIf.h"
 #include "HTTPServer.h"
 
-EthernetNetIf ethif( IpAddr(192,168,1,102), // IP
+EthernetNetIf ethif( IpAddr(10,0,0,200), // IP
                      IpAddr(255,255,255,0), // Subnet mask
-                     IpAddr(192,168,1,1),   // Gateway
-                     IpAddr(192,168,1,1) ); // DNS
+                     IpAddr(10,0,0,1),   // Gateway
+                     IpAddr(8,8,8,8) ); // DNS
 HTTPServer server;
-LocalFileSystem local("local"); // Define local file mount point
+SDFileSystem sd(p5, p6, p7, p8, "sd"); // Define local file mount point
 DigitalOut led1(LED1);  // for alive check
 
+PwmOut pwm(LED4);  // messing about with the pwm
+
 int main(void)
 {
+    pwm = 0.5;
+    
     // EthernetNetIf setup
-    if( ethif.setup() )
-    {
+    if( ethif.setup() ) {
         return 1;
     }
 
     // Mount local file path on web root path
-    FSHandler::mount("/local", "/");
+    FSHandler::mount("/sd", "/");
     // Set web root path handler
     server.addHandler<FSHandler>("/");
-    
+    server.addHandler<RPCHandler>("/rpc"); 
+
     // Set http port
     server.bind(80);
 
     Timer tm;
     tm.start();
-    while(1)
-    {
+    while(1) {
         Net::poll();
-        if( 1.0 < tm.read() )
-        {
+        if( 1.0 < tm.read() ) {
             led1 = !led1;   // high->low, low->high
             tm.start();
         }