Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EthernetNetIf HTTPServer TextLCD mbed
Fork of HTTPServerHelloWorld by
HTTPServerHelloWorld.cpp
00001 #include "mbed.h" 00002 #include "EthernetNetIf.h" 00003 #include "HTTPServer.h" 00004 #include "TextLCD.h" //LCD用 00005 00006 TextLCD lcd(p24, p26, p27, p28, p29, p30); //LCDの設定 00007 00008 LocalFileSystem fs("webfs"); //ファイルシステムの設定 00009 00010 00011 EthernetNetIf eth; 00012 HTTPServer svr; 00013 00014 DigitalOut led1(LED1); 00015 00016 int main() { 00017 lcd.cls(); 00018 lcd.printf("Setting up...\n"); 00019 EthernetErr ethErr = eth.setup(); 00020 if(ethErr) 00021 { 00022 lcd.cls(); 00023 lcd.printf("Error %d in setup.\n", ethErr); 00024 return -1; 00025 } 00026 lcd.cls(); 00027 lcd.printf("Setup OK\n"); 00028 00029 FSHandler::mount("/webfs", "/"); //ここで /webfs をWebパスのルートに割り当てる 00030 00031 svr.addHandler<SimpleHandler>("/"); //Default handler 00032 svr.bind(80); 00033 00034 lcd.cls(); 00035 lcd.printf("Listening...\n"); 00036 00037 Timer tm; 00038 tm.start(); 00039 //Listen indefinitely 00040 while(true) 00041 { 00042 Net::poll(); 00043 if(tm.read()>.5) 00044 { 00045 led1=!led1; //Show that we are alive 00046 tm.start(); 00047 } 00048 } 00049 00050 return 0; 00051 }
Generated on Wed Jul 27 2022 14:47:24 by
1.7.2
