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: PWM_Tone_Library SDFileSystem WIZnetInterface httpServer_orgel mbed
Fork of Internet_Orgel by
main.cpp
- Committer:
- irinakim
- Date:
- 2015-10-19
- Revision:
- 21:a5e91b90d7a3
- Parent:
- 19:0ea7e7a9ebae
- Child:
- 23:17bcb0c6105c
File content as of revision 21:a5e91b90d7a3:
#include "mbed.h"
#include "EthernetInterface.h"
#include "FsHandler.h"
#include "HTTPServer.h"
#include "SDFileSystem.h"
#ifdef TARGET_WIZWIKI_W7500
//Choose one of file system.
SDFileSystem local(SD_MOSI, SD_MISO, SD_CLK, SD_SEL, "local");//PB_3, PB_2, PB_1, PB_0
//LocalFileSystem local("local");
#endif
#ifdef TARGET_WIZWIKI_W7500
uint8_t mac_addr[6] = {0x00, 0x08, 0xDC, 0x00, 0x01, 0x02};
#endif
EthernetInterface eth;
HTTPServer svr;
char ip_addr[] = "192.168.240.111";
char subnet_mask[] = "255.255.255.0";
char gateway_addr[] = "192.168.240.1";
//#define DHCP //If uncomment, W7500 runs DHCP
int main()
{
HTTPFsRequestHandler::mount_eth(ð);
HTTPFsRequestHandler::mount("/local/", "/");
svr.addHandler<HTTPFsRequestHandler>("/");
#ifdef TARGET_WIZWIKI_W7500
#ifdef DHCP
eth.init(mac_addr); //Use DHCP
#else
eth.init(mac_addr, ip_addr, subnet_mask, gateway_addr); //Not Use DHCP
#endif
#else
#ifdef DHCP
eth.init(); //Use DHCP
#else
eth.init(ip_addr, subnet_mask, gateway_addr); //Not Use DHCP
#endif
#endif
printf("Check Ethernet Link\r\n");
while(1) //Wait link up
{
if(eth.link() == true)
break;
}
printf("Link up\r\n");
eth.connect();
printf("Server IP Address is %s\r\n", eth.getIPAddress());
if (!svr.start(80, ð)) {
error("Server not starting !");
exit(0);
}
while(1) {
svr.poll();
}
}
