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: SDFileSystem WIZnetInterface httpServer_with_Ethernt mbed
main.cpp
00001 #include "mbed.h" 00002 #include "EthernetInterface.h" 00003 #include "FsHandler.h" 00004 #include "HTTPServer.h" 00005 #include "SDFileSystem.h" 00006 00007 #if defined(TARGET_WIZWIKI_W7500)||defined(TARGET_WIZWIKI_W7500P) 00008 //Choose one of file system. 00009 SDFileSystem local(SD_MOSI, SD_MISO, SD_CLK, SD_SEL, "local");//PB_3, PB_2, PB_1, PB_0 00010 //LocalFileSystem local("local"); 00011 #endif 00012 00013 #if defined(TARGET_WIZWIKI_W7500)||defined(TARGET_WIZWIKI_W7500P) 00014 uint8_t mac_addr[6] = {0x00, 0x08, 0xDC, 0x53, 0xAE, 0x90}; 00015 #endif 00016 00017 EthernetInterface eth; 00018 00019 // Declare HTTP Server Class 00020 HTTPServer svr; 00021 00022 DigitalOut myled(D1); 00023 00024 // Set Server Network 00025 char ip_addr[] = "172.16.73.112"; 00026 char subnet_mask[] = "255.255.255.0"; 00027 char gateway_addr[] = "172.16.73.254"; 00028 00029 int main() { 00030 00031 // HTTPFsRequestHandler::mount_eth(ð); 00032 HTTPFsRequestHandler::mount("/local/", "/"); 00033 svr.addHandler<HTTPFsRequestHandler>("/"); 00034 00035 #if defined(TARGET_WIZWIKI_W7500)||defined(TARGET_WIZWIKI_W7500P) 00036 00037 #ifdef DHCP 00038 eth.init(mac_addr); //Use DHCP 00039 #else 00040 eth.init(mac_addr, ip_addr, subnet_mask, gateway_addr); //Not Use DHCP 00041 #endif 00042 00043 #else 00044 00045 #ifdef DHCP 00046 eth.init(); //Use DHCP 00047 #else 00048 eth.init(ip_addr, subnet_mask, gateway_addr); //Not Use DHCP 00049 #endif 00050 00051 #endif 00052 00053 printf("Check Ethernet Link\r\n"); 00054 /*while(1) //Wait link up 00055 { 00056 if(eth.link() == true) 00057 break; 00058 }*/ 00059 printf("Link up\r\n"); 00060 00061 eth.connect(); 00062 printf("Server IP Address is %s\r\n", eth.getIPAddress()); 00063 if (!svr.start(80, ð)) { 00064 00065 error("Server not starting !"); 00066 exit(0); 00067 } 00068 00069 while(1) { 00070 svr.poll(); 00071 } 00072 }
Generated on Sun Jul 24 2022 23:45:18 by
1.7.2