test

Dependencies:   EthernetNetIf HTTPServer TextLCD mbed

Files at this revision

API Documentation at this revision

Comitter:
damir
Date:
Tue Jan 13 18:27:02 2015 +0000
Commit message:
test

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
TextLCD.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
diff -r 000000000000 -r 5a5b49dad9cf EthernetNetIf.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/EthernetNetIf.lib	Tue Jan 13 18:27:02 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mamezu/code/EthernetNetIf/#0f6c82fcde82
diff -r 000000000000 -r 5a5b49dad9cf HTTPServer.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HTTPServer.lib	Tue Jan 13 18:27:02 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/screamer/code/HTTPServer/#284f2df30cf9
diff -r 000000000000 -r 5a5b49dad9cf TextLCD.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Tue Jan 13 18:27:02 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/TextLCD/#44f34c09bd37
diff -r 000000000000 -r 5a5b49dad9cf main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Jan 13 18:27:02 2015 +0000
@@ -0,0 +1,59 @@
+#include "mbed.h"
+#include "EthernetNetIf.h"
+#include "HTTPServer.h"
+#include "TextLCD.h"
+
+TextLCD lcd(p15, p16, p17, p18, p19, p20);
+
+
+DigitalOut led1(LED1, "led1");
+DigitalOut led2(LED2, "led2");
+DigitalOut led3(LED3, "led3");
+DigitalOut led4(LED4, "led4");
+
+LocalFileSystem fs("webfs");
+
+EthernetNetIf eth;  
+HTTPServer svr;
+
+int main() {
+  Base::add_rpc_class<DigitalOut>();
+
+  lcd.printf("Setting up...\n");
+  EthernetErr ethErr = eth.setup();
+  if(ethErr)
+  {
+   lcd.printf("Error %d in setup.\n", ethErr);
+    return -1;
+  }
+  lcd.printf("Setup OK\n");
+  
+  FSHandler::mount("/webfs", "/files"); //Mount /webfs path on /files web path
+  FSHandler::mount("/webfs", "/"); //Mount /webfs path on web root path
+  
+  svr.addHandler<SimpleHandler>("/hello");
+  svr.addHandler<RPCHandler>("/rpc");
+  svr.addHandler<FSHandler>("/files");
+  svr.addHandler<FSHandler>("/"); //Default handler
+  //Example : Access to mbed.htm : http://a.b.c.d/mbed.htm or http://a.b.c.d/files/mbed.htm
+  
+  svr.bind(80);
+  
+  lcd.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;
+
+}
diff -r 000000000000 -r 5a5b49dad9cf mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Jan 13 18:27:02 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/63bcd7ba4912
\ No newline at end of file