HTTPサーバテスト
Dependencies: EthernetNetIf mbed HTTPServer
Revision 0:546e1420b6eb, committed 2011-11-20
- Comitter:
- jksoft
- Date:
- Sun Nov 20 06:05:36 2011 +0000
- Commit message:
Changed in this revision
diff -r 000000000000 -r 546e1420b6eb EthernetNetIf.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/EthernetNetIf.lib Sun Nov 20 06:05:36 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/donatien/code/EthernetNetIf/#bc7df6da7589
diff -r 000000000000 -r 546e1420b6eb HTTPServer.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HTTPServer.lib Sun Nov 20 06:05:36 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/donatien/code/HTTPServer/#d753966e4d97
diff -r 000000000000 -r 546e1420b6eb main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Nov 20 06:05:36 2011 +0000 @@ -0,0 +1,46 @@ +#include "mbed.h" +#include "EthernetNetIf.h" // CuÌwb_Et@CðCN[h +#include "HTTPServer.h" // CuÌwb_Et@CðCN[h + +// CuÌè` +EthernetNetIf eth; // C[TlbgEC^[tF[X +HTTPServer svr; // HTTPT[o +DigitalOut led1(LED1); // ®ì\¦p +DigitalOut led2(LED2, "led2"); // uEUã©çµ¤½ßɼOðt¯é +AnalogIn ain(p15,"tmp"); // uEUã©çµ¤½ßɼOðt¯é +LocalFileSystem fs("webfs"); // uEUã©çmbedhCuÉANZX + +int main() { + printf("Setting up...\n"); + + EthernetErr ethErr = eth.setup(); // lbg[NÉÚ± + + if(ethErr) { + // Ú±Ùí + printf("Error %d in setup.\n", ethErr); + return -1; + } + printf("Setup OK\n"); + + // HTTPT[oÌÝè + FSHandler::mount("/webfs", "/"); + svr.addHandler<RPCHandler>("/rpc"); + svr.addHandler<FSHandler>("/"); + svr.bind(80); + + printf("Listening...\n"); + + Timer tm; + tm.start(); // ^C}EX^[g + + while(true) + { + Net::poll(); // lbg[N + if(tm.read()>.5) // ^C}EX^[gµÄ©ç0.5b½Á½ç·é + { + led1=!led1; // LEDð_Å + tm.start(); // ^C}EX^[g + } + } + return 0; +} \ No newline at end of file
diff -r 000000000000 -r 546e1420b6eb mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Nov 20 06:05:36 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/9a9732ce53a1