toshio masuda
/
HTTP_server_DHCP
HTTP
Fork of HTTP_S_text by
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 #include "TextLCD.h" 00003 #include "EthernetNetIf.h" 00004 #include "HTTPServer.h" 00005 #include "RPCFunction.h" //ADD Here!! 00006 00007 DigitalOut led1(LED1,"led1"); 00008 DigitalOut led2(LED2,"led2"); 00009 DigitalOut led3(LED3,"led3"); 00010 DigitalOut led4(LED4,"led4"); 00011 TextLCD lcd(p24, p26, p27, p28, p29, p30); 00012 00013 EthernetNetIf ethif; 00014 HTTPServer server; 00015 LocalFileSystem local("local"); 00016 void LcdWrite(char *input,char *output); //ADD Here!! 00017 RPCFunction rpcFunc(&LcdWrite, "LcdWrite"); //ADD Here!! 00018 00019 ///////////////////////////////////////////////////// 00020 // main 00021 ///////////////////////////////////////////////////// 00022 int main(void) { 00023 Base::add_rpc_class<DigitalOut>(); 00024 lcd.cls(); 00025 lcd.locate(0,0); 00026 lcd.printf("Program init.. "); 00027 00028 if (ethif.setup()) { 00029 error("Ethernet setup failed."); 00030 return 1; 00031 } 00032 00033 IpAddr ethIp=ethif.getIp(); 00034 lcd.locate(0,1); 00035 lcd.printf("%d.%d.%d.%d", ethIp[0], ethIp[1], ethIp[2], ethIp[3]); 00036 led1=1; 00037 wait(1); 00038 00039 server.addHandler<SimpleHandler>("/hello"); 00040 server.addHandler<RPCHandler>("/rpc"); 00041 FSHandler::mount("/local", "/"); 00042 server.addHandler<FSHandler>("/"); 00043 server.bind(80); 00044 00045 while (1) { 00046 Net::poll(); 00047 } 00048 return 0; 00049 } 00050 00051 ///////////////////////////////////////////////////// 00052 // LCD 00053 ///////////////////////////////////////////////////// 00054 void LcdWrite(char *input , char *output) { 00055 lcd.cls(); 00056 lcd.locate(0,0); 00057 lcd.printf("%s",input); 00058 }
Generated on Wed Jul 20 2022 12:20:53 by 1.7.2