mbedをHTTPサーバ化。TextLCDライブラリを追加して状態をPCレスで把握できるようにしました。

Dependencies:   EthernetNetIf HTTPServer TextLCD mbed

Fork of HTTPServerHelloWorld by Donatien Garnier

Files at this revision

API Documentation at this revision

Comitter:
Dromar
Date:
Sun Feb 10 16:03:08 2013 +0000
Parent:
2:bd69e4df7955
Commit message:
mbed?HTTP?????TextLCD?????????????PC????????????????

Changed in this revision

HTTPServerHelloWorld.cpp 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
--- a/HTTPServerHelloWorld.cpp	Fri Jul 09 14:46:34 2010 +0000
+++ b/HTTPServerHelloWorld.cpp	Sun Feb 10 16:03:08 2013 +0000
@@ -1,6 +1,12 @@
 #include "mbed.h"
 #include "EthernetNetIf.h"
 #include "HTTPServer.h"
+#include "TextLCD.h" //LCD用
+
+TextLCD lcd(p24, p26, p27, p28, p29, p30); //LCDの設定
+
+LocalFileSystem fs("webfs"); //ファイルシステムの設定
+  
 
 EthernetNetIf eth;  
 HTTPServer svr;
@@ -8,19 +14,25 @@
 DigitalOut led1(LED1);
 
 int main() {
-  printf("Setting up...\n");
+  lcd.cls();
+  lcd.printf("Setting up...\n");
   EthernetErr ethErr = eth.setup();
   if(ethErr)
   {
-    printf("Error %d in setup.\n", ethErr);
+    lcd.cls();
+    lcd.printf("Error %d in setup.\n", ethErr);
     return -1;
   }
-  printf("Setup OK\n");
+  lcd.cls();
+  lcd.printf("Setup OK\n");
   
+  FSHandler::mount("/webfs", "/"); //ここで /webfs をWebパスのルートに割り当てる
+ 
   svr.addHandler<SimpleHandler>("/"); //Default handler
   svr.bind(80);
   
-  printf("Listening...\n");
+  lcd.cls();
+  lcd.printf("Listening...\n");
     
   Timer tm;
   tm.start();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Sun Feb 10 16:03:08 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/TextLCD/#44f34c09bd37